Software >> Programming >> Java >> J2EE >> What is the relationship between JVM Heapsize and MaxPermSizeRelation Between JVM MaxPermSize and HeapSizeØ Options that begin with -X are non-standard (not guaranteed to be supported on all VM implementations), and are subject to change without notice in subsequent releases of the JDK. Ø Options that are specified with -XX are not stable and are not recommended for casual use. These options are subject to change without notice. The allocation of Heap Size for the JVM at startup is done based on parameters given below:
With regards to the MaxPermSize, this argument adjusts the size of the "permanent generation." As I understand it, the perm gen holds information about the "stuff" in the heap. So, the heap stores the objects and the perm gen keeps information about the "stuff" inside of it. Consequently, the larger the heap, the larger the perm gen needs to be. In simpler term we can define the two parameters as given below:
ordinary heap = app objects
The permanent generation is used to hold reflective data of the VM itself such as class objects and method objects. These reflective objects are allocated directly into the permanent generation, and it is sized independently from the other generations."
-Xms3072M -Xmx3072M -XX:+AggressiveHeap -XX:MaxPermSize=1024M.........
Doubt Is:When we say MaxPermSize = 1024M does it mean that it is taken from
Answer is No, PermSize is additional to the -Xmx value set by the user on the JVM options. But MaxPermSize allows for the JVM to be able to grow the PermSize to the amount specified. Initially when the VM is loaded, the MaxPermSize will still be the default value (32mb for -client and 64mb for -server) but will not actually take up that amount until it is needed. On the other hand, if you were to set BOTH PermSize and MaxPermSize to 256mb, you would notice that the overall heap has increased by 256mb additional to the -Xmx setting.
Heap size does not determine the amount of memory your process usesThere are a number of separate memory pools in the JVM, whose maximum sizes are set separately. If you monitor your java process with an OS tool like top or taskmanager, you may see the amount of memory you use exceed the total amount you have specified for –Xmx and -XX:MaxPermSize. -Xmx limits the java heap size,and -XX:MaxPermSize limits java permanent space. However 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 + XX:MaxPermSize. References [1] http://indrayanblog.blogspot.sg/2011/03/cxv.html
|