Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get peak memory usage of python script?

I'm doing some extensive scientific python calculations and whant to know execution time and memory footprint of python script.

So how to get peak memory usage of python script?

If it matters I'm on Windows and use python 2.7.

like image 683
mrgloom Avatar asked Oct 30 '15 07:10

mrgloom


1 Answers

Sounds like you are looking for a memory profiler. Memory_profiler is one that you can dive into which line is giving you the problems and with some querying you can figure out which area is the biggest in memory consumption.

https://pypi.python.org/pypi/memory_profiler and since you are using windows it will also need this https://pypi.python.org/pypi/psutil

Good Luck!

like image 190
Back2Basics Avatar answered Oct 13 '22 19:10

Back2Basics