Skip to content

Instantly share code, notes, and snippets.

@waichee
Created February 11, 2019 04:17
Show Gist options
  • Save waichee/c112207fd814067b5ae9ed0b07a92cb6 to your computer and use it in GitHub Desktop.
Save waichee/c112207fd814067b5ae9ed0b07a92cb6 to your computer and use it in GitHub Desktop.
# install the required packages
pip install memory_profiler
pip install matplotlib
# run the profiler to record the memory usage
# sample 0.1s by defaut
mprof run --include-children python fantastic_model_building_code.py
# plot the recorded memory usage
mprof plot --output memory-profile.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment