[clue-tech] understanding Linux process memory usage?

Angelo Bertolli angelo.bertolli at gmail.com
Mon Mar 23 14:42:05 MDT 2009


Jim Ockers wrote:
> Hi CLUEbies,
>
> I wonder if anyone out there can help me understand process memory usage in Linux?
> I am trying to reconcile the memory usage information from 'top' with what is
> actually happening in the OS. 
>
> It seems that something in the top numbers is out to lunch.  I am wondering about 
> how to interpret the linux memory usage information as reported by ps and top.
>
> Specifically, RSS, SIZE, SHARE, etc.  I am trying to analyze some problematic 
> systems performance and nobody on the 'net seems to understand exactly how to
> tell how much memory footprint a process has, exactly.  My googling has turned
> up lots of questions and not very many answers.
>
> Is it just process executable code size?  data too?  What about the stack?  What 
> about X, which seems to map in video memory into the VM address space.  I know 
> how big the total VM pie is, and I need to figure out exactly how big of a slice 
> of that pie each process is using, especially X.
>
> Does anyone know how to do this?  Please feel free to chime in.
>   

I only know in a vague sort of way.  I haven't really looked into the 
details.  It can be complicated for two basic reasons:

1) Libraries can get shared within memory, so do you count that as the 
footprint or not?

2) Some of the memory used is "active" and some is in swap.

Also, Linux uses memory to buffer file systems too when it thinks it is 
smart to do so.  (Not to mention that some of the file systems are in 
memory.)  Here is something that might be a little bit helpful from 
http://www.freshblurbs.com/how-profile-memory-linux

 VSIZE (Virtual memory SIZE) - The amount of memory the process is
currently using. This includes the amount in RAM and the amount in
swap.

RSS (Resident Set Size) - The portion of a process that exists in
physical memory (RAM). The rest of the program exists in swap. If
the computer has not used swap, this number will be equal to
VSIZE.




More information about the clue-tech mailing list