def printReferrers(self, numEach = 3): counts = list(set(self._count2types.keys())) counts.sort() counts.reverse() for count in counts: types = makeList(self._count2types[count]) for typ in types: print '\n\nTYPE: %s' % repr(typ) for i in xrange(min(numEach, len(self._type2objs[typ]))): obj = self._type2objs[typ][i] print '\nOBJ: %s\n' % safeRepr(obj) referrers = gc.get_referrers(obj) print '%s REFERRERS:\n' % len(referrers) if len(referrers): print getNumberedTypedString(referrers, maxLen = 80, numPrefix = 'REF') continue print '<No Referrers>'
def printReferrers(self, numEach=3): """referrers of the first few of each type of object""" counts = list(set(self._count2types.keys())) counts.sort() counts.reverse() for count in counts: types = makeList(self._count2types[count]) for typ in types: print "\n\nTYPE: %s" % repr(typ) for i in xrange(min(numEach, len(self._type2objs[typ]))): obj = self._type2objs[typ][i] print "\nOBJ: %s\n" % safeRepr(obj) referrers = gc.get_referrers(obj) print "%s REFERRERS:\n" % len(referrers) if len(referrers): print getNumberedTypedString(referrers, maxLen=80, numPrefix="REF") else: print "<No Referrers>"
def printReferrers(self, numEach=3): """referrers of the first few of each type of object""" counts = list(set(self._count2types.keys())) counts.sort() counts.reverse() for count in counts: types = makeList(self._count2types[count]) for typ in types: print('\n\nTYPE: %s' % repr(typ)) for i in range(min(numEach, len(self._type2objs[typ]))): obj = self._type2objs[typ][i] print('\nOBJ: %s\n' % safeRepr(obj)) referrers = gc.get_referrers(obj) print('%s REFERRERS:\n' % len(referrers)) if len(referrers): print(getNumberedTypedString(referrers, maxLen=80, numPrefix='REF')) else: print('<No Referrers>')