[Numpy-discussion] memory usage

emil sidky@uchicago....
Tue Oct 14 17:02:56 CDT 2008

   I'm having a problem with my python code, using numpy, chewing up too
much memory.
In the following, I boiled down my program to the simplest example that
has the problem:

from numpy import *
for i in range(1000):
   a = random.randn(512**2)
   b = a.argsort(kind='quick')

This loop takes a couple of minutes to run on my machine.
While running 'top' concurrently, I see that the memory usage is
increasing as the loop progresses. By the time the loop is finished
the python process is taking over 30% of the memory, and I have 8 GB RAM.

Is there some way to prevent this from happening?
It's fine if the alternative slows the code down a bit.
Im'm using python2.4 and numpy 1.0.1

Thanks in advance,

More information about the Numpy-discussion mailing list