[SciPy-user] memory usage

David Cournapeau david@ar.media.kyoto-u.ac...
Thu Aug 9 22:03:49 CDT 2007

Emanuele Zattin wrote:
> yeah i noticed that as well.
> i think i'm on the right way now... i think this is all due to the
> heavy use of broadcasting i did in order to optimize performance... i
> might as well try to go with some inline C code with nested for loops.
In the cases broadcasting is expensive memory wise, ctypes is really a 
good option, too, specially for basic numerical works done in a few 
lines of C (typically, you allocate your data in python with 
numpy.empty, and gives those arrays to C functions).

Concerning memory usage, I have just discovered a fantastic tool for 
memory usage: massif. It is part of valgrind, and it gives you this kind 
of graphs:


Your scripts will run extremely slowly (10-20x slower), but it is 
extremely useful, at least for me.


More information about the SciPy-user mailing list