mgedmin
In addition to RSS and VIRT it might be nice to track PSS (Proportional set size, like RSS except shared memory pages are divided by the number of processes that share them). You can get it from /proc/$pid/smaps_rollup, on a line containing Pss: nnn kB (If smaps_rollup is not available, you'd have to read /proc/$pid/smaps itself and sum the Pss for every mapping. I'm not sure which kernel version added smaps_rollup.)