[Numpy-discussion] Memory leak when looking .flags

Cyrille Rosset rosset at lal.in2p3.fr
Sun May 20 22:56:52 EDT 2007


Ok, that works fine with python.
But not in ipython... is there some other trick ?
(there's a whole collection of _* variables in there...)
Cyrille.

Robert Kern a écrit :
> Cyrille Rosset wrote:
>> Hi,
>>
>> I'm not sure this is the right mailing list for this, but it seems 
>> there's a memory leak when looking at flags :
>>
>>  >>> from numpy import *
>>  >>> x=ones(50000000)       #==> python use 25% of memory (ok)
>>  >>> del x
>> #==> memory usage fall back to almost zero (as seen in top)
>> Thqt's good.
>>
>> but if I look at flags before the del :
>>  >>> x=ones(50000000)
>>  >>> x.flags
>>    C_CONTIGUOUS : True
>>    F_CONTIGUOUS : True
>>    OWNDATA : True
>>    WRITEABLE : True
>>    ALIGNED : True
>>    UPDATEIFCOPY : False
>>  >>> del x
>>  >>> who()
>>
>> Upper bound on total bytes  =       0
>>
>> That looks nice, but the memory usage by python (in top) is still 25%... 
>>   Isn't it a bug ?
> 
> No, x.flags is still being stored in _. It still has a reference to x. Evaluate
> something else (e.g. ">>> 1") to clear that out and the memory should be released.
> 




More information about the NumPy-Discussion mailing list