All pastes #544945 Raw Edit

Stuff

public text v1 · immutable
·published 2007-06-06 17:26 UTC
rendered paste body
import gc

def dump_garbage():
    print '\nGarbage:'
    gc.collect()
    if len(gc.garbage):
    
        print '\nLeaked objects:'
        for x in gc.garbage:
            s = str(x)
            if len(s) > 77: s = s[:73]+'...'
            print type(x), '\n  ', s
    
        print 'There were %d leaks.' % len(gc.garbage)
    else:
        print 'Python garbage collector did not detect any leaks.'
        print 'However, it is still possible there are leaks in the C code.'



gc.enable()
gc.set_debug(gc.DEBUG_LEAK & ~gc.DEBUG_SAVEALL)

# test here
a=object()


dump_garbage()