Created
August 4, 2017 14:10
-
-
Save felipessalvatore/8cca03cfca6c87068438c04664790315 to your computer and use it in GitHub Desktop.
memory debug Python
This file contains hidden or 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 tracemalloc | |
tracemalloc.start() | |
# ... run your application ... | |
snapshot = tracemalloc.take_snapshot() | |
top_stats = snapshot.statistics('lineno') | |
print("[ Top 10 ]") | |
for stat in top_stats[:10]: | |
print(stat) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment