JVM Process vs JVM Heap memory usage
I have read through this Process Memory Vs Heap -- JVM and i have the same problem.
The jvm process memory usage keeps increasing and never shrinks.I checked by doing a top on the linux server. The application is scheduling jobs to a cluster ( Using Quartz + Sun Java DRMAA API )
The java heap space is staying within the limits during the application life cycle but the jvm process is showing a steady climb in memory usage and never coming down.
Is this a memory leak ? If so , why is heap space being within the limits. Can someone explain this.
UPDATE: I have -Xmx1600m -Xms1600m when i track through jconsole i can see the heap space well within this limit aroung 450m but the top command shows the process is using more than 900m.
The total virtual memory used is the sum of the maximum heap + thread stacks + direct memory + perm gen + share libraries. This never shrinks.
The actual main memory used depends on how much of the virtual memory has been occupied. Shared libraries are shared so having multiple JVMs won't result in this memory doubling etc.
The JVM never releases memory to the OS, however if main memory is not used for a long time it can be swapped out if this is need.
The actual memory consumption is more than what what you set with Xmx etc, that's normal. "java will allocate memory for other things, including a stack for each thread. It is not unusual for the total memory consumption of the VM to exceed the value of -Xmx."
The paramaters -Xmx1600m -Xms1600m tells the JVM to allocate 1600MB of memory at minimum and 1600MB of memory at maximum. So the JVM should allocate 1600MB on start up and the never release it.
If you want the JVM to release memory back to the OS then the -Xms should be as low, and you probably have to use Java 1.7 with the new G1 garbage collector. stefankrause.net/wp/?p=14.
Using Mac OS X 10.8 and Java 1.7 with -Xms32m -Xmx256m -XX:+UseG1GC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 the memory is release back to the OS after a System.gc() is run.
链接地址: http://www.djcxy.com/p/19840.html上一篇: 非堆内存和加载类的数量不断增加
下一篇: JVM进程vs JVM堆内存使用情况