from guppy import * ## ## heapsize() - Return size of heap (memory used by objects) in MB ## def heapsize(format='string'): heapsize = hpy().heap().size / 1024.0 / 1024.0 if format == 'string': return '%.2f MB' % (heapsize) elif format == 'int': return int(heapsize) else: return heapsize