how do I find memory leaks?

Heather A. Drury heather at thalamus.wustl.edu
Wed Jul 21 12:31:27 EDT 1999


Hi,

I'm relatively new to python and am using it (and Tkinter, 
VTK, NumPy, numpyio, and some other modules that I've probably
forgotten) to write a volume/slice visualization package.

The program has gotten to a fairly advanced stage but I've run
into what appears to be a major memory leak. I come
from the C programming world and have previously used
Purify to debug memory leaks. Alas, I thought using python/vtk
would take care of all this memory garbage for me (although
I'm probably not doing something I should be). 

Here's what I see on a SGI Indigo2 Max Impact with 448 Meg of memory:

	before I start application	350 meg free
	start application		342 
	read volume 1			284
	re-read volume 1		229	
	re-read volume 1		192	
	re-read volume 1		173	
	re-read volume 1		155	

Each time the user reads a new volume it uses numpyio to read
the volume in and then recreates the slice views. 

Over time as the user continues to use the application, the
computer starts using up swap space and eventually the program 
crashes.  I haven't the faintest idea how to begin to debug this
problem. I'm sure I need to provide some more detail but the
code is about 2000 lines now and I'm not sure what detail
would be useful.

Any hints/suggestions/pointers would be greatly appreciated.

TIA,

heather




More information about the Python-list mailing list