35

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 ?

ali_m
  • 71,714
  • 23
  • 223
  • 298
  • btw, the `sys.getsizeof` function mentioned in http://stackoverflow.com/questions/4416654/is-there-a-memory-profiler-for-python2-7 works for Python 3.2 as well – hvr Oct 21 '11 at 21:48
  • 1
    Possible duplicate of [How do I profile memory usage in Python?](https://stackoverflow.com/questions/552744/how-do-i-profile-memory-usage-in-python) – Don Kirkby Aug 14 '17 at 16:35
  • YiFei Zhu has ported Guppy-PE/Heapy to Python 3 creating Guppy3. It can be reached here: https://github.com/zhuyifei1999/guppy3/ – svenil Aug 29 '19 at 03:26

3 Answers3

12

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

Pankrat
  • 5,206
  • 4
  • 31
  • 37
4

objgraph is compatible with Python 3

NoDataDumpNoContribution
  • 10,591
  • 9
  • 64
  • 104
2

memprof works for Python3:

http://jmdana.github.io/memprof/

It will log and plot the memory footprint of all your variables.

jmdana
  • 429
  • 5
  • 5