Created
January 5, 2016 15:34
-
-
Save elyezer/62f8c586fb5626f0c171 to your computer and use it in GitHub Desktop.
Using Python memory_profiler
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
$ pip install memory_profiler psutil | |
$ python -m memory_profiler sample_file.py |
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
@profile | |
def func_to_test(): | |
# operations | |
func() |
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
$ python -m memory_profiler manifest.py | |
Filename: manifest.py | |
Line # Mem usage Increment Line Contents | |
================================================ | |
6 41.332 MiB 0.000 MiB @profile | |
7 def func(): | |
8 42.215 MiB 0.883 MiB with manifests.clone() as manifest: | |
9 41.332 MiB -0.883 MiB pass | |
10 41.332 MiB 0.000 MiB print(manifest.filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment