numarray memory leak
Peter Dobcsanyi
peter at designtheory.org
Sun Nov 14 04:20:31 EST 2004
Robert Kern <rkern at ucsd.edu> wrote:
> Peter Dobcsanyi wrote:
>> Calling the following function with a large enough 'n' causes memory leak.
>>
>> import numarray as N
>>
>> def loop(n, m=100):
>> for i in xrange(n):
>> a = N.zeros((m,m))
>> N.matrixmultiply(a, a)
>>
>> If the matrixmultiply line is commented out, there is no leak, the
>> program has a stable memory size.
>>
>> I am using numarray 1.1, the result is the same with Python 2.3.4 and
>> 2.4b2.
>
> I don't see such behavior on Mac OSX 10.3, Python 2.3, CVS numarray and
> n=10000.
>
> Could you try CVS numarray? What n did you use?
With n a few hundreds (say n>=500), the continuous growth of the
program's memory footprint is quite noticeable. I am working on Linux
(Debian testing), I monitor the memory usage of the program by top.
The allocated memory is never released.
I have noticed this problem of memory leak in connection with numarray a
few months ago in a program of mine. The program processes the incidence
matrices of thousands of combinatorial structures read from a file one
by one. As the number of combinatorial objects went up I started running
out of memory even on a machine with 2 Gbyte memory. It took me a while
to pinpoint that it was caused by matrix multiplication.
I will try the CVS.
Peter
More information about the Python-list
mailing list