7
I am having issues with a server running out of physical memory and I'm having troubles discerning whether it is from my application's Java process or something else on the server. Let's take the following scenario:
Server physical memory: 3747MB
Java -Xms64m
Java -Xmx512m
Java XX:MaxPermSize=512m
When I boot up the server, the OS (RHEL) reports that 487MB are being used, using your favorite memory reporting tool (top, cat /proc/meminfo | grep Mem, free -m
, etc). When I start my Java process (pid 123), it uses around 215MB of physical memory (as reported by RES memory in ps -f -p 123
), taking my total used memory up to around 700MB.
If I let it run for an entire day, the RES memory for my process fluctuates a little, but is generally consistent. However the total server memory has steadily increased around 1500MB, taking it to a total of 2200MB.
If my java heap size or perm gen heap were growing, wouldn't it be reflected in the process' RES memory?
Also, I can't seem to account for that extra 1500MB anywhere.
# ps aux | awk '{ RES+=$6 } END { printf("RES: %.2fMB\n", RES/1024) }'
RES: 722.23MB
Can anyone help me find that lost memory? I am basically trying to figure out if this is my problem with the application, or the infrastructure team's problem with their server build.
6Do you count disk cache? If you use
free -m
, you should look at the-/+ buffers/cache
row. – yiding – 2013-01-16T04:10:41.457You may use visualvm and see details of java process.. Are there any other process running and taking memory ? – Jayan – 2013-01-16T04:28:18.717
3A running Linux system will quickly end up allocating all "free" memory to disk cache. This memory is still free because it can be reclaimed from cache and given to processes without any delay. – Ex Umbris – 2013-01-16T07:16:49.653
It does appear that my missing memory is taken by the disk cache. I am still puzzled, though, because my process will eventually die, without any errors or exceptions. I will need to adjust my metrics to gather more data. Thanks! – schmimd04 – 2013-01-16T14:18:30.383