def typesizes(): """Count the number of bytes for each type tracked by the GC. Note that the GC does not track simple objects like int or str. Note that classes with the same name but defined in different modules will be lumped together. """ stats = {} objs = get_objs() kwargs = {'limit' : 0} for o, sz in zip(objs, asizeof.asizesof(*objs, **kwargs)): stats.setdefault(type(o).__name__, 0) stats[type(o).__name__] += sz return stats
def typesizes(): """Count the number of bytes for each type tracked by the GC. Note that the GC does not track simple objects like int or str. Note that classes with the same name but defined in different modules will be lumped together. """ stats = {} objs = get_objs() kwargs = {'limit': 0} for o, sz in zip(objs, asizeof.asizesof(*objs, **kwargs)): stats.setdefault(type(o).__name__, 0) stats[type(o).__name__] += sz return stats
def getMemoryFootprint(cls): if asizeof is not None: return asizeof.asizesof(cls.__dictJobs)