def dump_memory(signum, frame):
 timestamp = datetime.now().isoformat()
 format_str = '{}/meliae.{}.{}.{{}}.dump'.format(tempfile.gettempdir(), timestamp, os.getpid())
 scanner.dump_all_objects(format_str.format('pre-gc'))
 for gen in xrange(3):
  gc.collect(gen)
  scanner.dump_all_objects(format_str.format('gc-gen-{}'.format(gen)))

def dump_memory ( signum , frame ) : timestamp = datetime . now ( ) . isoformat ( ) format_str = '{}/meliae.{}.{}.{{}}.dump' . format ( tempfile . gettempdir ( ) , timestamp , os . getpid ( ) ) scanner . dump_all_objects ( format_str . format ( 'pre-gc' ) ) for gen in xrange ( 3 ) : gc . collect ( gen ) scanner . dump_all_objects ( format_str . format ( 'gc-gen-{}' . format ( gen ) ) )
dump memory stats for the current process to a temp directory .