memory usage (how to debug a memory leak?)

Marcus Stojek stojek at part-gmbh.de
Mon Mar 10 12:28:14 EST 2003


Hi,

I have written a middle scale app using Python 2.2.2, wxPython 2.3.
and vtk 4.0 (graphics) on Windows NT.  I have some c-extensions too
(swig 3.1.17)

The app has one ParentFrame and I can open and close ChildFrames
(MDI) and visualilze things in them using vtk.

Everything works as it should, but  the task manager in Windows shows
that the memory usage is not reduced when I close one or more of the
Child Windows . If I close the app all memory is freed and I never get
an error message of any kind. 

I tried to del() everything before closing a window, I checked all
refcounts and I checked the swig interfaces. No memory is allocated
inside my c-extensions. Instead I pass a Numeric.array of the right
size to the c-extension and inside the c-code this array is filled
with result values.

Now my question is not what is wrong with my code, but how I can find
out.

Is there any way to get a list like [(object1,sizeof(object1)),...]?
Or a Python tool that tells my something about memory usage?
How do you hunt a memory leak?
Or is it just the Task Manager that's fooling me?


Thanks,
Marcus





More information about the Python-list mailing list