[SciPy-user] Memory quirk

Travis E. Oliphant oliphant@enthought....
Sat Nov 3 14:52:05 CDT 2007


Anand Patil wrote:
> Hi all,
>
> The following script leaks memory when an array with dtype=object is 
> used instead of a list. Is this a bug, or a behavior I should be 
> expecting? Any help is much appreciated.
It's not really a bug, just an unsupported use of NumPy object arrays
which do not participate in Python's cyclic garbage collector.    To add
support would require more re-factoring than it has been worth to
anybody at this point.

It would require handing object array allocations differently so that
they participate in the garbage collection strategy and it may not be
possible (I'm not sure if an object can sometimes have it's memory
allocated using it's own allocators and sometimes have them allocated
using PyObject_GC_New and still participate in the garbage collection
cycle).

-Travis




More information about the SciPy-user mailing list