[SciPy-User] Memory Leak? Problems with deleting numpy arrays.

Christopher Barker Chris.Barker@noaa....
Fri Nov 5 11:48:15 CDT 2010


On 11/5/10 9:38 AM, Sebastian Walter wrote:
> In Python it is always one larger than it should be:
>
> In [17]: import sys
>
> In [18]: import numpy
>
> In [19]: x = numpy.array([1,2,3])
>
> In [20]: sys.getrefcount(x)
> Out[20]: 2

That's because the refcount is incremented when x is passed to the 
getrefcount() function itself -- it will drop back to one when the 
function is done running.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the SciPy-User mailing list