[Tutor] Any way of monitoring a python program's memory utilization?
carroll at tjc.com
Thu Jul 17 00:58:51 CEST 2008
Is there any way of having my program see how much memory it's using?
I'm iterating through a vey large tarfile (uncompressed, it would be about
2.4G, with about 2.5 million files in it) and I can see from some external
monitors that its virtual storage usage just grows and grows, until my
whole system finally grinds to a halt after about 1.2 million members have
I'd like to try various strategies, but as I try them I'd like for it to
monitor its own memory usage so I can assess the different strategies I
use, and in any event, abort before it gets to the point of hanging my
Is there anything within Python (I'm on 2.5) that can check this? Failing
that, are there any Windows/XP line-oriented commands that I could invoke
and parse the output of? (I also have Cygwin installed, in case there are
any gnu-based commands that woudl work, too.)
More information about the Tutor