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

Thomas J. Duck tom.duck at dal.ca
Wed Jul 25 23:01:05 EDT 2007


      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.


More information about the NumPy-Discussion mailing list