473,379 Members | 1,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

numarray memory leak

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.

Peter
Jul 18 '05 #1
5 1571
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?

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Jul 18 '05 #2
Robert Kern <rk***@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

Jul 18 '05 #3
>>>>> "Peter" == Peter Dobcsanyi <pe***@designtheory.org> writes:
Peter> With n a few hundreds (say n>=500), the continuous growth
Peter> of the program's memory footprint is quite noticeable. I am
Peter> working on Linux (Debian testing), I monitor the memory
Peter> usage of the program by top. The allocated memory is never
Peter> released.

Peter> I have noticed this problem of memory leak in connection
Peter> with numarray a few months ago in a program of mine. The
Peter> program processes the incidence matrices of thousands of
Peter> combinatorial structures read from a file one by one. As
Peter> the number of combinatorial objects went up I started
Peter> running out of memory even on a machine with 2 Gbyte
Peter> memory. It took me a while to pinpoint that it was caused
Peter> by matrix multiplication.

Peter> I will try the CVS.

Yep, numarray 1.1 has a memory leak in dot, which Matrix multiply
uses. It also has a leak in cumulative boolean functions like
sometrue. Both are fixed in CVS.

JDH
Jul 18 '05 #4
John Hunter <jd******@ace.bsd.uchicago.edu> wrote:

Peter> I will try the CVS.

Yep, numarray 1.1 has a memory leak in dot, which Matrix multiply
uses. It also has a leak in cumulative boolean functions like
sometrue. Both are fixed in CVS.


Indeed, I tried the CVS version and that fixed the problem; for me, at
least. I am a bit worried about the users of my package depending on
numarray. Most of them would not be able (or willing to) pull down the
CVS tree.

Peter
Jul 18 '05 #5
>>>>> "Peter" == Peter Dobcsanyi <pe***@designtheory.org> writes:

Peter> Indeed, I tried the CVS version and that fixed the problem;
Peter> for me, at least. I am a bit worried about the users of my
Peter> package depending on numarray. Most of them would not be
Peter> able (or willing to) pull down the CVS tree.

You might ask on the numpy-discussion list when the release of
numarray 1.2 is expected. My guess is it won't be too long from now.
If it is going to be a while and this is a serious problem for your
package, you have the option of tarring up CVS yourself and/or
building a win32 installer and linking to this on your site for users
concerned about memory leaks.

There is a section of matplotlib code that depends on matrix multiply,
and I have this FAQ for memory leaks

http://matplotlib.sourceforge.net/faq.html#LEAKS

JDH
Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RJS | last post by:
Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out...
4
by: Marco Bubke | last post by:
Hi Ok, I get a reproduceable seqmentation fault. Ok, fist the code: cdef NumArray array_to_double(NumArray array): # maybe here is memoty leak! cdef NumArray flat_array_obj flat_array_obj...
11
by: grv | last post by:
So it is supposed to be very fast to have an array of say 5 million integers stored in a binary file and do a = numarray.fromfile('filename', (2, 2, 2)) numarray.add(a, 9, a) but how is that...
3
by: Mizrandir | last post by:
I'd like to subclass numarray's array. I'd like to add some methods and override others like __init__. I don't know how to do this and haven't found help searching the manual or the web, can...
5
by: Bill Mill | last post by:
Hello all, I've pickled a numarray array object using cPickle like so: pickle = cPickle.Pickler(fout, -1) pickle.dump((myarray, list1, list2)) and this seems to work fine, until I try to...
8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.