def gc_histogram():
 result = {}
 for o in gc.get_objects():
  t = type(o)
  count = result.get(t, 0)
  result[t] = (count + 1)
 return result

def gc_histogram ( ) : result = { } for o in gc . get_objects ( ) : t = type ( o ) count = result . get ( t , 0 ) result [ t ] = ( count + 1 ) return result
returns per-class counts of existing objects .