All pastes #286684 Raw Edit

Miscellany

public python v1 · immutable
#286684 ·published 2006-12-20 21:28 UTC
rendered paste body
def pobj():    import gc    from types import ClassType    gc.collect()    objects = gc.get_objects()    print "%d objects:" % (len(objects),)    instances = {}    for obj in objects:        if isinstance(obj, object) and type(obj) is not ClassType:            cls = obj.__class__            instances[cls] = instances.get(cls, 0) +1    for t, c in instances.items():        print "%6d :: %s" % (c, t)