diff -r f7c84674bdec Lib/test/regrtest.py --- a/Lib/test/regrtest.py Fri Jul 25 12:23:08 2014 +0300 +++ b/Lib/test/regrtest.py Fri Jul 25 17:51:06 2014 +0200 @@ -1,4 +1,15 @@ #! /usr/bin/env python +import tracemalloc +tracemalloc.start(20) + +def dump_object_trace(obj): + tb = tracemalloc.get_object_traceback(obj) + if tb is None: + return + print("Object %r" % (obj,)) + for line in tb.format(): + print(line) + print("") """ Usage: @@ -579,6 +590,9 @@ def main(tests=None, testdir=None, verbo if gc.garbage: print "Warning: test created", len(gc.garbage), print "uncollectable object(s)." + if tracemalloc.is_tracing(): + for obj in gc.garbage: + dump_object_trace(obj) # move the uncollectable objects somewhere so we don't see # them again found_garbage.extend(gc.garbage)