Observing memory usage for python programs

Several times already, I wish I could observe the memory usage of some python scripts/modules, and more importantly, which portion is consumed in which objects. For C/python problems, I’ve used massif from valgrind, but this is not alway usable. On the bzr ML, several alternatives have been suggested:

  1. reducing-the-footprint-of-python-applications
  2. Heapy
  3. Another solution which requires recompiling the python interpreter: see here. Unfortunately, numpy does not work with an interpreter compiled with this (at least on linux).

Will try those methods when I will have some more time, and report a bit in more details