[Tutor] (no subject)

Remco Gerlich scarblac@pino.selwerd.nl
Thu, 29 Mar 2001 23:39:53 +0200


On Thu, Mar 29, 2001 at 04:30:04PM -0500, D-Man wrote:
> On Thu, Mar 29, 2001 at 01:01:00PM -0800, Glen Bunting wrote:
> | Let me rephrase the question.  I didn't state the question very clearly.  I
> | am trying to write a python script on Mandrake Linux that will check the
> | amount of free memory available, similar to using the 'free' command.  I
> | already have a script written in sh which does this by calling  the free
> | command, but I am trying to re-write it completely in python.
> 
> Oh, that's cool.  I'd like it when you are done ;-).
> 
> I don't think looking at free's implementation will help much because
> I think it looks at /proc/mem or something like that.

Yes, /proc/meminfo, so does top.

There aren't any Python functions for this, I think. There's no way to do
this in a portable way, not even between types of Unix. As far as I know.

But of course, it's not hard to read and parse /proc/meminfo yourself, of
course, if you only need it on Linux :).

-- 
Remco Gerlich