[Numpy-discussion] Memory leak when looking .flags
Robert Kern
robert.kern at gmail.com
Sun May 20 22:44:19 EDT 2007
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.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion
mailing list