forked from bartvdbraak/blender
ifdef out support for for python owning and freeing BPy_StructRNA because this is only used for doc generation and it makes _every_ blender/python instance 4 bytes bigger - vertex/bezier point/object/scene/group etc.
This commit is contained in:
parent
85fe36ab61
commit
3a82a690ab
@ -397,7 +397,9 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
|
|||||||
|
|
||||||
|
|
||||||
pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
|
pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
|
||||||
|
#ifdef PYRNA_FREE_SUPPORT
|
||||||
pyrna->freeptr= TRUE;
|
pyrna->freeptr= TRUE;
|
||||||
|
#endif
|
||||||
return (PyObject *)pyrna;
|
return (PyObject *)pyrna;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,11 +957,13 @@ static int pyrna_struct_clear(BPy_StructRNA *self)
|
|||||||
/* use our own dealloc so we can free a property if we use one */
|
/* use our own dealloc so we can free a property if we use one */
|
||||||
static void pyrna_struct_dealloc(BPy_StructRNA *self)
|
static void pyrna_struct_dealloc(BPy_StructRNA *self)
|
||||||
{
|
{
|
||||||
|
#ifdef PYRNA_FREE_SUPPORT
|
||||||
if (self->freeptr && self->ptr.data) {
|
if (self->freeptr && self->ptr.data) {
|
||||||
IDP_FreeProperty(self->ptr.data);
|
IDP_FreeProperty(self->ptr.data);
|
||||||
MEM_freeN(self->ptr.data);
|
MEM_freeN(self->ptr.data);
|
||||||
self->ptr.data= NULL;
|
self->ptr.data= NULL;
|
||||||
}
|
}
|
||||||
|
#endif /* PYRNA_FREE_SUPPORT */
|
||||||
|
|
||||||
#ifdef USE_WEAKREFS
|
#ifdef USE_WEAKREFS
|
||||||
if (self->in_weakreflist != NULL) {
|
if (self->in_weakreflist != NULL) {
|
||||||
@ -5495,7 +5497,9 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pyrna->ptr= *ptr;
|
pyrna->ptr= *ptr;
|
||||||
|
#ifdef PYRNA_FREE_SUPPORT
|
||||||
pyrna->freeptr= FALSE;
|
pyrna->freeptr= FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_PYRNA_STRUCT_REFERENCE
|
#ifdef USE_PYRNA_STRUCT_REFERENCE
|
||||||
pyrna->reference= NULL;
|
pyrna->reference= NULL;
|
||||||
|
@ -62,6 +62,11 @@
|
|||||||
#if defined(USE_PYRNA_INVALIDATE_GC) && defined(USE_PYRNA_INVALIDATE_WEAKREF)
|
#if defined(USE_PYRNA_INVALIDATE_GC) && defined(USE_PYRNA_INVALIDATE_WEAKREF)
|
||||||
#error "Only 1 reference check method at a time!"
|
#error "Only 1 reference check method at a time!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* only used by operator introspection get_rna(), this is only used for doc gen
|
||||||
|
* so prefer the leak to the memory bloat for now. */
|
||||||
|
// #define PYRNA_FREE_SUPPORT
|
||||||
|
|
||||||
/* --- end bpy build options --- */
|
/* --- end bpy build options --- */
|
||||||
|
|
||||||
struct ID;
|
struct ID;
|
||||||
@ -108,7 +113,10 @@ typedef struct {
|
|||||||
* hold onto the collection iterator to prevent it from freeing allocated data we may use */
|
* hold onto the collection iterator to prevent it from freeing allocated data we may use */
|
||||||
PyObject *reference;
|
PyObject *reference;
|
||||||
#endif /* !USE_PYRNA_STRUCT_REFERENCE */
|
#endif /* !USE_PYRNA_STRUCT_REFERENCE */
|
||||||
|
|
||||||
|
#ifdef PYRNA_FREE_SUPPORT
|
||||||
int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
|
int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
|
||||||
|
#endif /* PYRNA_FREE_SUPPORT */
|
||||||
} BPy_StructRNA;
|
} BPy_StructRNA;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user