I’m digging into a mail server and trying to figure out the actual memory usage of some processes. ‘ps’ only gives a little information, which may or may not be incredibly useful:
[root@mail tmp]# ps aux|grep someprocess USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 14368 0.0 0.0 3884 668 pts/0 R+ 11:26 0:00 someprocess
From that you can see the VSZ and RSS. I’m not totally sure what exactly those include, but I’ve learned enough to know that they may include the size of shared libraries and things that aren’t unique to this process. Upon trying to find out a little more, I came across this post which explained it well, and has a simple perl script that breaks it down even further:
http://bmaurer.blogspot.com/2006/03/memory-usage-with-smaps.html
When running that smem.pl script with a PID, it produces something like this:
[root@mail1 tmp]# ./smem.pl 14291 VMSIZE: 9840 kb RSS: 3692 kb total 1892 kb shared 816 kb private clean 984 kb private dirty
From that, you can see how much of the memory usage is ‘Private’ and therefore unique to this process. This is the best way that I have found to view actual memory usage that is unique to a given process.