[olug] understanding Linux memory usage
Ryan Stille
ryan at cfwebtools.com
Wed Feb 20 20:58:51 UTC 2008
I have a process (a java virtual machine) that according to ps and top,
is taking up 3GB of "virtual memory" size. I would think "virtual
memory" would be swap (not real memory, but virtual, like swap, right?)
but the man page says it is swap + resident (physical) combined.
Here is the ps output:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
nobody 7147 21.1 6.6 3013876 271796 pts/0 Sl 14:44 1:04
/opt/coldfusion8/runtime/bin/....
Its corresponding line from top agrees:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7147 nobody 25 0 2943m 265m 12m S 0 6.7 1:06.01 coldfusion8
So why does the summary info at the top of the top output say that there
is only 687400k being used on the whole box, and that 0k swap is being used?
Here are those lines from top:
Mem: 4090516k total, 687400k used, 3403116k free, 42012k buffers
Swap: 787176k total, 0k used, 787176k free, 206808k cached
I know that the 265m of resident memory is contributing to the 687400k
total used... but its still not all making sense. I don't understand
how top and "free -m" can say there is over 3GB of free memory, when the
java process is supposed to be taking up 3GB or so (there is only 4GB on
the box).
The end goal here is to allow this java process to allocate as much
memory as possible for itself. If free -m is showing 3GB free, couldn't
other processes end up using that memory? My java memory switches are
-Xmx2500m -Xms2500m, BTW.
-Ryan
More information about the OLUG
mailing list