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 ?
Pympler is a Python memory profiler that is compatible with both Python 2.x and Python3.x.
objgraph is compatible with Python 3
memprof
works for Python3:
http://jmdana.github.io/memprof/
It will log and plot the memory footprint of all your variables.
来源:https://stackoverflow.com/questions/7758699/is-there-any-working-memory-profiler-for-python3