Last active
February 7, 2017 00:33
-
-
Save harlowja/0d35e8887126a6b5e78ef96452b7bfe5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import tracemalloc | |
import pickle | |
if __name__ == '__main__': | |
for fn in sys.argv[1:]: | |
print("Dumping " + fn) | |
with open(fn, 'rb') as fh: | |
snapshot = pickle.load(fh) | |
stats = snapshot.statistics('traceback') | |
for i, stat in enumerate(stats[0:10]): | |
print(" Index = %s" % i) | |
print(" Size = %sb/%skb/%smb" % (stat.size, stat.size/1024, stat.size/(1024**2))) | |
print(" Count = %s" % stat.count) | |
print(" Traceback:") | |
for line in stat.traceback.format(): | |
print(" " + line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment