How does one get current variable mem usage?

J

Jeem

I'm seeking to tune the memory usage of a python program, having discovered
unexpected swapping. I would expect that there would be some way to ask the
interpreter for the total memory usage of all currently live objects, or
even of a specified object. If such means exist, I haven't found them in
the Python 2.2.2 documentation. I'm currently making do by reading the
contents of /proc/PID/statm, but that includes not only the interpreter
itself but also space requested from the operating system, but currrently
unused for live variables, and it seems not to go down much when large objects
are killed, e.g. by making them unreachable with varname=""; there are no
obvious other references to the object formerly associated with varname.

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,966
Members
47,515
Latest member
Harvey7327

Latest Threads

Top