JVM parameter settings-vmargs-xms128m-xmx512m-XX: permsize = 64 m-XX: maxpermsize = 128 m

Source: Internet
Author: User
Tags xms

-Vmargs-xms128m-xmx512m-XX: permsize = 64 m-XX: maxpermsize = 128 m

There are several questions:
1. What are the meanings of each parameter?
2. Why can eclipse be started after I set-xmx and-XX: maxpermsize to 512m on some machines, but some machines cannot be started?
3. Why didn't eclipse execute the corresponding settings when writing the above parameters to the eclipse. ini file?
Let's answer them one by one.

 

1. What are the meanings of each parameter?

 
In the parameters-vmargs indicates setting JVM parameters, so the following parameters are actually JVM parameters. First, let's take a look at the JVM memory management mechanism, and then explain what each parameter represents
. Heap and non-heap memory, according to the official statement: "Java
A virtual machine has a heap. The heap is the runtime data area, and the memory of all class instances and arrays is allocated from this place. Heap is in Java
Created when the VM is started ." "The memory outside the heap in JVM is called non-heap memory (
Memory )". JVM manages two types of memory: heap and non-heap. In short, heap is the memory available for Java code and is reserved for developers.
Self-use, so the method area, JVM internal processing or optimization of the required memory (such as JIT
Editing
The translated code cache), the Code of each class structure (such as the runtime data pool, field and method data), and method and constructor are all in non-heap memory. 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. The default idle heap memory is smaller
At 40%, the JVM will increase the heap size 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 is generally set to-XMS,
-Xmx is equal 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 physical.
Memory 1/4. JVM memory limit (maximum)
First, JVM memory is limited to the actual maximum physical memory (nonsense! If the physical memory is infinitely large, the maximum JVM memory has a great relationship with the operating system. Simply put, although the 32-bit Processor
Although the controllable memory space is 4 GB, the specific operating system will impose a limit, which is generally 2 GB-3 GB (generally 1.5 GB-2 GB in Windows, linux
2G-3G), and the 64-bit or higher processor will not be limited.

 2. Why can eclipse be started after I set-xmx and-XX: maxpermsize to 512m on some machines, but some machines cannot be started?



Through the introduction of JVM memory management, we have learned that JVM memory includes two types: heap memory and non-heap memory. In addition, the maximum JVM memory depends on the actual physical memory and operating system. Therefore, setting VM parameters causes program startup failure mainly due to the following reasons:
1) In the parameter, the value of-XMS is greater than-xmx, or the value of-XX: permsize is greater than-XX: maxpermsize;
 
2)
-Xmx value and-XX: The sum of maxpermsize exceeds the maximum JVM memory limit, such as the maximum memory limit of the current operating system or the actual physical memory. Speaking of physical
Memory here, it should be noted that if your memory is 1024 MB, but the actual usage in the system is not 1024 MB, because some of them are occupied by hardware.

 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: the parameter is like "item
In this form, if there is a space in the middle, you need to wrap the text. If there is a space in the value, you need to use double quotation marks to include it. For example, we use-VM
The C:/Java/jre1.6.0/bin/javaw.exe parameter sets the virtual machine. In the eclipse. ini file, write the following:-VM
C:/Java/jre1.6.0/bin/javaw.exe as mentioned above, the final parameters 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 found in "configuration" in the "help"-"about eclipse SDK" Window of Eclipse.
View Details.
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, the-launcher. xxmaxpermsize (note that there are two connection lines at the top) has the same meaning as the-XX: maxpermsize parameter. I think the only one
The prefix is the parameter set during startup of eclipse.exe, which is the JVM parameter used by eclipse. In fact, you can set one of the two, so you can set
-Launcher. xxmaxpermsize and use # In the next line to comment out.

 4. 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)

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.