How to find free resident memory in Linux using python

Sandy dksreddy at gmail.com
Sat Oct 2 10:06:37 EDT 2010


Hi all,
I want to find how much free memory (RAM) is available in my system
using python. I tried psutil, parsing /proc/meminfo, top output etc
but not satisfied. For example my gnome-system-monitor gui shows I am
using 1GB (25%) of my RAM while /proc/meminfo, top, psutil says around
2GB is used. Is there anyway I can get the correct availble memory,
may be adding cache, buffers etc to free memory in these and get some
value that matches with the gnome-system-monitor gui?

For example 'top' says:
Mem:   3995048k total,  2231924k used,  1763124k free,    43480k
buffers

while gnome-system-monitor gui shows I am using 1GB (25%)


Thanks in advance,
dksr



More information about the Python-list mailing list