[Numpy-discussion] creating a Numeric array from a numpy array LEAKS memory
Pauli Virtanen
pav at iki.fi
Fri Oct 24 14:52:06 EDT 2008
Fri, 24 Oct 2008 14:39:59 -0400, Jose Borreguero wrote:
> My bad. Using the intermediate list does *not* leak. Still, the original
> problems stays. Can anyone run the following code in their machine and
> see if they have leaks? Maybe it only happens to me :(*
>
> import numpy,Numeric
> big=10000000
> na=numpy.array([0.0,])
> for i in range(big):
> Na=Numeric.array(na,Numeric.Float)*
Yep, leaks also here: (Numeric 24.2, numpy 1.2.0)
import sys, numpy, Numeric
na = numpy.array([0.0])
for i in xrange(1000000):
foo = Numeric.array(na, Numeric.Float)
print sys.getrefcount(na)
The getrefcount prints 1000002, so it seems like there's a refcount error
somewhere. But
na = numpy.array([0.0])
for i in xrange(1000000):
foo = numpy.array(na, numpy.float_)
print sys.getrefcount(na)
refcounts correctly.
--
Pauli Virtanen
More information about the NumPy-Discussion
mailing list