E pur si muove

Resident Set Size (RSS) from /proc/pid/stat

Thursday, January 22, 2009

Most UNIX-like systems have information about processes stored in /proc/pid/ files, so does Linux.

If you would want to get the Resident Set Size (RSS) of a process on Linux you could find this in a number of files:

  • /proc/pid/stat: targetted for scanf(3)
  • /proc/pid/statm: targetted for scanf(3) but just memory information (more detailed)
  • /proc/pid/status: targetted at humans

Oddly enough if you check these three files for the RSS memory you will get different results! It seem both stat and statm have the wrong RSS information. It is a mystery to me why.

Thursday, January 22, 2009 |


Unknown said...

Not always. You can get the pagesize in python by:


And in C:

#include <unistd.h>

On my system I get 4096...

New comments are not allowed.

Subscribe to: Post Comments (Atom)