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

Travis Oliphant oliphant.travis at ieee.org
Mon Jul 30 16:05:28 EDT 2007


Thomas J. Duck wrote:
> 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.
>

What other packages do you depend on that use Numeric.  These should get 
ported to use NumPy.  Perhaps somebody can help do that.

-Travis



More information about the NumPy-Discussion mailing list