[Python-Dev] refleak hunting fun!

Brett C. bac at OCF.Berkeley.EDU
Thu Aug 14 19:44:00 EDT 2003

Michael Hudson wrote:

> Prompted by finding my own refcounting leaks in test_descr, I'm now
> looking to spread the misery :-)
> I've hacked regrtest (hacks attached) to do some very crude monitoring
> of sys.gettotalrefcount().

<list of tests that might be leaking like the Titanic>

> Some however, seem to be real.  test_sax, test_socket and
> test_codeccallbacks seem to be the most alarming.  The TrackRef class
> Tim posted a link to is likely to be indispensable in hunting these.

<Brett's potentially ignorant newbie questions follow>

Is there any reason not to add Michael's code to regrtest.py (or at 
least get it to the point of where it could be added)?  Finding leaks as 
part of running a test would be nice.  We could even have a set in 
regrtest.py that stored tests known to throw the test off (because of 
caching or whatever).  Obviously testing would be option that is off by 
default.  How about Tim's code class?  Or is finding leaks that much of 
a random black art and there is not good way of doing it?

Part of the reason I ask is I have had a patch sitting on SF for a while 
now that implements the skips.txt file idea that was brought up back 
when Martin was complaining about expected skips on certain platforms 
and such.  Is there a general view of not touching regrtest.py unless 
needed since breaking that would not be fun?


More information about the Python-Dev mailing list