[Numpy-discussion] Memory leak for in-place Numeric+numpy addition

Thomas J. Duck tom.duck@dal...
Wed Jul 25 22:01:05 CDT 2007


Hi,

      There seems to be a memory leak when arrays are added in-place  
for mixed Numeric/numpy applications.  For example, memory usage  
quickly ramps up when the following program is executed:


import Numeric,numpy
x = Numeric.zeros((2000,2000),typecode=Numeric.Float64)
for j in range(200):
     print j
     y = numpy.zeros((2000,2000),dtype=numpy.float64)
     x += y


If I use exclusively Numeric arrays, or exclusively numpy arrays, or  
add a Numeric array in-place to a numpy array, there is not a  
problem.  It is only in the case that a numpy array is added in place  
to a Numeric array that the leak exists.  Deleting the variable y in  
each iteration has no effect.

      I am using numpy 1.0.1-8 and Numeric 24.2-7 under Debian linux.

      I'm not sure if this is a numpy or Numeric problem, but thought  
I would send it along in case there is interest and the problem can  
be resolved.  Unfortunately, I can't move to an exclusively numpy or  
Numeric approach because of the other packages that I depend on.

Thanks,
Tom




More information about the Numpy-discussion mailing list