memory leaks - tools and docs

Christian Heimes lists at cheimes.de
Thu Nov 24 23:05:11 EST 2011


Am 25.11.2011 04:00, schrieb Aljosa Mohorovic:
> i mostly used http://guppy-pe.sourceforge.net/#Heapy but found
> http://pysizer.8325.org/ and http://code.google.com/p/pympler/ also
> interesting.

Guppy is a extremely powerful tool because it can also track non GC
objects without a debug build of Python. I only wished it would have a
user friendly and easy to script interface. The _.more thing is killing
me. :(

I'm using a very simple and almost for free approach to keep track of
memory usage with psutil. After every unit test case I store RSS and VM
size with psutil.Process(os.getpid()).get_memory_info(),
threading.active_count(), len(gc.garbage) and len(gc.get_objects()). It
doesn't show what's going wrong, but it helps me to isolate the code
paths, that may introduce memory leaks and reference cycles. Since we
use continuous integration (Jenkins) I can track down regressions more
easily, too.

Christian




More information about the Python-list mailing list