hi,

we use the code below for tracking object counts.
heiko



#!/usr/bin/env python

import sys
import types

def get_refcounts():
    d = {}
    # collect all classes
    for m in sys.modules.values():
        for sym in dir(m):
            o = getattr (m, sym)
            if type(o) is types.ClassType:
                d[o] = sys.getrefcount (o)
    # sort by refcount
    pairs = map (lambda x: (x[1],x[0]), d.items())
    pairs.sort()
    pairs.reverse()
    return pairs

def print_top_100():
    for n, c in get_refcounts()[:100]:
        print '%10d %s' % (n, c.__name__)

if __name__ == '__main__':
    print_top_100()



-- 
brainbot technologies ag 
schwalbacherstr. 74   65183 wiesbaden . germany
vox +49 611 238505-0  fax ++49 611 238505-1
http://brainbot.com/  mailto:[EMAIL PROTECTED]

_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to