Decent way to trace resource leaks?

David Rushby woodsplitter at rocketmail.com
Wed Mar 24 06:35:11 EST 2004


Kirk Strauser <kirk at strauser.com> wrote in message:
> Ideally, I'd like to find a way to dump the process's object hierarchy to
> the screen or a file in a tree or graph format.  Even without variable
> names, it'd be tremendously helpful to see that there are 87 instances of
> Foo objects, each with 20 Bar objects as data members.

Take a look at Misc/SpecialBuilds.txt in the Python source
distribution.  I find the facilities described therein quite useful
for eliminating reference count leaks.

> Although I'm running the application on Windows, I'm doing all development 
> on a Linux system (using Subversion to synchronize source trees across 
> machines, in case anyone is interested), so I'd prefer something native to
> Python and not a Windows-specific GUI debugger.

If you're using C libraries that you think might be leaking memory
"the traditional way", try Valgrind (http://valgrind.kde.org/ ). 
Valgrind is the best thing since sliced bread.



More information about the Python-list mailing list