Reputation: 93
My web application is throwing OOM errors. It was given 25GB memory. Application was loaded tested and we see thet memory is ramping up. But I expect the JVM to release the memory after full gc. How come JVM is not releasing the virtual memory even after the application is used.
Here are the JVM settings:
-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/logs/gcc.log
-XX:MaxPermSize=96m -XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode -XX:+UseCompressedOops -XX:+UseCompressedStrings
-Xmx30g
Here is the "top" command output:
top - 02:09:42 up 117 days, 5:24, 4 users, load average: 0.00, 0.01, 0.05 Tasks: 140 total, 1 running, 139 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 62167808k total, 60854992k used, 1312816k free, 73444k buffers Swap: 0k total, 0k used, 0k free, 17789504k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 17206 java 20 0 55.1g 40g 12m S 0.3 68.2 298:41.08 java
Here is the "free" command output:
total used free shared buffers cached Mem: 62167808 60855448 1312360 0 73592 17789532 -/+ buffers/cache: 42992324 19175484 Swap: 0 0 0
Please appreciate any leads to fix this issue.
Upvotes: 1
Views: 433
Reputation: 8379
Not all garbage collection algorithms in HotSpot JVM release virtual memory to OS after GC.
Two algorithms which can do it are
-XX:+UseSerialGC
-XX:+UseG1GC
You are using CMS -XX:+UseConcMarkSweepGC
which never releases memory to OS.
Here you can find quick summary of all GC algorithms in HotSpot.
Upvotes: 3