Friday, June 6, 2008

How to measure memory consumption of a program on Linux

The Linux operating system provide detailed information about memory processes use. You can use the ps or the top tools; or you canread information written on the /proc filesystem.

There you can find detailed information for every jobs running on your machine. You can get a list of the running jobs with:


ps -A

and then look, for example, into the file /proc/5995/status, where 5995 is the Job ID:

cat /proc/5995/status

VmSize: 7660 kB
VmLck: 0 kB
VmRSS: 5408 kB
VmData: 4204 kB
VmStk: 20 kB
VmExe: 576 kB
VmLib: 2032 kB