CentOS server. What does it mean when the total used RAM does not equal the sum of RES?
- by Michael Green
I'm having a problem with a virtual hosted server running CentOS. In the past month a process (java based) that had been running fine started having problems getting memory when the JVM was started.
One strange thing I've noticed is that when I start the process, the PID says it is using 470mb of RAM while the 'used' memory immediately drops by over a 1GB. If I run 'top', the total RES used across all processes falls short of the 'used' listed at the top by almost 700mb.
The support person says this means I have a memory leak with my process. I don't know what to believe because I would expect a memory leak to simply waste the memory the process is allocated not to consume additional memory that doesn't show up using 'top'.
I'm a developer and not a server guy so I'm appealing to the experts. To me, if the total RES memory doesn't add up to the total 'used' it indicates that something is wrong with my virtual server set-up. Would you also suspect a memory leaking java process in this case?
If I use free before:
total used free shared buffers cached
Mem: 2097152 149264 1947888 0 0 0
-/+ buffers/cache: 149264 1947888
Swap: 0 0 0
free after:
total used free shared buffers cached
Mem: 2097152 1094116 1003036 0 0 0
-/+ buffers/cache: 1094116 1003036
Swap: 0 0 0
So it looks as though the process is using (or causing to be used) nearly 1GB of RAM. Since the process (based on top is only using 452mb, does that mean that the kernal is all of a sudden using an additional 500mb?