Memory Monitor

Mitch Chapman Mitch.Chapman at bioreason.com
Tue Jun 25 12:05:09 EDT 2002


Marco Catunda wrote:
> 
> Hello,
> 
>         What is the best way to monitor usage memory?
> 
>         I have used "os.system( 'ps %d' % os.getpid() )" but I
>         don't know if it is the best way?

Can't tell if you're using Linux or some other *nix variant.  If
you are using Linux, this might do what you want:

	inf = open("/proc/self/status", "r")
	print inf.read()
	inf.close()


'course, you probably want more concise output, e.g.:

        os.system("cat /proc/self/status | grep VmSize")

-- 
Mitch Chapman
Mitch.Chapman at bioreason.com



More information about the Python-list mailing list