def Objects(self, typename): print "%d instances of type %s. Referrers :-" % ( objgraph.count(typename), typename) done = {} for r in objgraph.by_type(typename): if isinstance(r, list): print "%s" % str(r[:min(20, len(r))]) else: print "%s" % str(r)
def referents_count(typename): print "%d instances of type %s. Referents :-" % ( objgraph.count(typename), typename) done = {} for r in objgraph.by_type(typename): for o in gc.get_referents(r): name = _get_key(o) if name != "type" and name != typename and not name in EXCLUDED and not name in done: done[name] = True count = objgraph.count(name) if count > 1: print " %s (%d)" % ( name, count )
def referrers(typename, max_depth=1): print("%d instances of type %s. Referrers :-" % (objgraph.count(typename), typename)) for r in objgraph.by_type(typename): _do_referrers(r, 1, max_depth, [])
def referents(typename, max_depth = 1): print "%d instances of type %s. Referents :-" % ( objgraph.count(typename), typename) for r in objgraph.by_type(typename): _do_referents(r, 1, max_depth)