[Numpy-discussion] memory usage

emil sidky at uchicago.edu
Tue Oct 14 18:02:56 EDT 2008


Hi,
   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,
Emil



More information about the NumPy-Discussion mailing list