Debugging leaking refcount

Jean-François Doyon jdoyon at ccrs.nrcan.gc.ca
Fri May 14 14:08:17 EDT 2004


Hello,

I'm working with Zope 2.7 and Python 2.3.3, and I have some leaks I'm trying
to track down.

So, more generally, I'm wondering what might be good techniques to track
down where references are
not getting released as they should and so on.

As someone who's never done anything like this in the past, here's what I'm
thinking:

1) Is there anyway to find out who owns the references? Or at least who/what
incremented/decremented
 the refcounts for a given instance?

2) Or could I add some print statements somewhere that will tell me when a
refcount is being
increased for a given class, and who is doing it? Maybe by doing some
Python/C if I have to?

3) Is there any way to inspect the suspect instances? Connect with gdb or
pdb or something like that? I've
never used a debugger like that unfortunately, any HOW-TO's out there on
this topic?

Any help, pointers, tips on this topic would be greatly appreciated!

Thanks,
J.F.





More information about the Python-list mailing list