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

Travis Oliphant oliphant.travis@ieee....
Mon Jul 30 15:05:28 CDT 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