I'd be inclined to try out Pyrasite (
http://pyrasite.com/). It attaches
to a running process with ptrace and lets you do stuff. The GUI has a
tab for doing memory profiling with Meliae (
https://launchpad.net/meliae),
which is similar to heapy, AFAIU.
You can also use RunSnakeRun (
http://pypi.python.org/pypi/RunSnakeRun) to
visualize the JSON of allocated object stats you get from Meliae.
Dozer (
http://pypi.python.org/pypi/Dozer) is a WSGI middleware memory
profiler that might be useful. I've never used it. AFAIU it gives you
a web page with a bunch of small graphs showing allocated object counts
by type.
I've also experimented with sticking a pdb.set_trace() somewhere in the
code, looking at
(pdb) gc.collect()
(pdb) for n in range(20): print random.choice(gc.get_objects())
hoping that statistics will work in my favour (most frequently allocated
objects would be the ones randomly chosen), and then using my own
objgraph (
http://pypi.python.org/pypi/objgraph) to trace the reference
chains to see what's holding those objects in memory.
HTH,
Marius Gedminas
--
We have an advanced scalable groupware communication environment (email)
-- Alan Cox