How properly manage memory of this PyObject* array?? (C extension)

seberino at spawar.navy.mil seberino at spawar.navy.mil
Tue Jul 18 11:54:26 EDT 2006


> *WRONG*. The object exists in and of itself. There may be one *or more*
> references to it, via pointers, scattered about in memory; they are
> *NOT* components of the object. A reference count is maintained inside
> the object and manipulated by Py_INCREF etc. The Python garbage
> collector knows *nothing* about the memory occupied by those pointers;

John - Thanks again,
I think I just learned something that is important.  If I free memory
associated
with pointers to Python objects it will NOT erase the Python objects!!!
I can merrily follow your orders to free(my_array); without worrying
about
nuking the Python objects too early!  Thanks for pointing out that
reference count is maintained inside the Python object itself.

Chris




More information about the Python-list mailing list