1. Heap Memory Allocation
The initial memory allocated by JVM is specified by-XMS. The default value is 1/64 of the physical memory. The maximum memory allocated by JVM is specified by-xmx. The default value is 1/4 of the physical memory. By default, when the free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of-xmx. When the free heap memory is greater than 70%, the JVM will reduce the minimum limit of heap until-XMS. Therefore, the server generally sets-XMS and-xmx to be equal to each other to avoid adjusting the heap size after each GC.
Non-heap memory allocation
JVM uses-XX: permsize to set the non-heap memory initial value. The default value is 1/64 of the physical memory. The maximum non-heap memory size is set by XX: maxpermsize. The default value is 1/4 of the physical memory.
2. Notes
1) The value of-XMS In the parameter cannot be greater than-xmx, or the value of-XX: permsize cannot be greater than-XX: maxpermsize;
2)-xmx value and-XX: The sum of maxpermsize cannot exceed the maximum JVM memory limit.
3. Why didn't eclipse execute the corresponding settings when writing the above parameters to the eclipse. ini file?
Why is the same parameter valid in the shortcut or command line and invalid in the eclipse. ini file? This is because we have not followed the setting rules of the eclipse. ini file:
Parameters are in the form of "item value". If there is space in the item and value, you need to wrap the line. If there is space in the value, You Need To enclose it with double quotation marks. For example, we use the-VM c: \ Java \ jre1.6.0 \ bin \ javaw.exe parameter to set the virtual machine. In the eclipse. ini file, we need to write it as follows:
-VM c: \ Java \ jre1.6.0 \ bin \ javaw.exe
As mentioned above, the final parameter can be written in eclipse. ini as follows:
-Vmargs-xms128m-xmx512m-XX: permsize = 64 m-XX: maxpermsize = 128 m
The actual running result can be viewed through the "configuration details" button in the "help"-"about eclipse SDK" window in eclipse.
Note that the eclipse. ini file in the eclipse compressed package contains the following content:
-Showsplash org. Eclipse. Platform -- launcher. xxmaxpermsize 256 m-vmargs-xms40m-xmx256m
Among them,-launcher. xxmaxpermsize (note that there are two connection lines at the top) and-XX: the meaning of maxpermsize.pdf is similar. I think the only difference is that the parameter set at startup of eclipse.exe, and the latter is the parameter in JVM used by eclipse. In fact, you can set one of the two, so here you can comment out-launcher. xxmaxpermsize and use # In the next line.
3. Other startup parameters. If you have a dual-core CPU, you can try this parameter:
-XX: + useparallelgc
Enables faster GC execution. (Only the newly added GC parameters in JDK 5)