In Python 2 there's a couple of tools but everything seems to be old and out-of-dated.
I've found PySizer and Heapy but everything seems to be Python2 oriented and would take a lot of effort to port.
objgraph is interesting but still not a fully working profiler
Which tool are using ?
The easiest way to profile a single method or function is the open source memory-profiler package. It's similar to line_profiler , which I've written about before . You can use it by putting the @profile decorator around any function or method and running python -m memory_profiler myscript.
Memory Profiler is an open-source Python module that uses psutil module internally, to monitor the memory consumption of Python functions. It performs a line-by-line memory consumption analysis of the function.
Memory profiling enables you to understand the memory allocation and garbage collection behavior of your applications over time. It helps you identify method calls in the context within which most memory was allocated and combine this information with the number of allocated objects.
Pympler is a Python memory profiler that is compatible with both Python 2.x and Python3.x.
objgraph is compatible with Python 3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With