Skip to content

Instantly share code, notes, and snippets.

@felipessalvatore
Created August 4, 2017 14:10
Show Gist options
  • Save felipessalvatore/8cca03cfca6c87068438c04664790315 to your computer and use it in GitHub Desktop.
Save felipessalvatore/8cca03cfca6c87068438c04664790315 to your computer and use it in GitHub Desktop.
memory debug Python
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