Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any working memory profiler for Python3 [closed]

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 ?

like image 886
Mathieu Leduc-Hamel Avatar asked Oct 13 '11 18:10

Mathieu Leduc-Hamel


People also ask

How do you run a memory profiling in python?

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.

How does memory profiler work python?

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.

What does memory profiler do?

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.


2 Answers

Pympler is a Python memory profiler that is compatible with both Python 2.x and Python3.x.

like image 100
Pankrat Avatar answered Oct 01 '22 22:10

Pankrat


objgraph is compatible with Python 3

like image 33
Trilarion Avatar answered Oct 01 '22 22:10

Trilarion