Details of eclipse.ini memory Settings

  • 2020-04-01 01:58:21
  • OfStack

-vmargs-xms128m-xmx512m-xx :PermSize= 64m-xx :MaxPermSize=128M
Here are a few questions:
1. What are the meanings of each parameter?
2. Why do I set -xmx and -xx :MaxPermSize to 512M for some machines, while Eclipse can be started, and some machines cannot?
3. Why do you write the above parameters to the eclipse.ini file?
Let's answer each of them
1. What are the meanings of each parameter?
-vmargs means to set the JVM parameters, so all of the following are JVM parameters. Let's first understand the JVM memory management mechanism, and then explain what each parameter represents.
Heap and non-heap memory
Officially, "the Java virtual machine has a heap, which is the runtime data area from which memory is allocated for all class instances and arrays. The heap is created when the Java virtual machine starts. "Memory outside of the heap in the JVM is called non-heap memory." You can see that the JVM mainly manages two types of memory: heap and non-heap. The heap is simply the memory that is accessible to Java code and is left for developers to use. Non-heap is what the JVM keeps for itself, so the method area, the memory needed for internal processing or optimization within the JVM (such as jit-compiled code cache), each class structure (such as runtime time pool, field, and method data), and the code for methods and constructors are all in non-heap memory.
Heap memory allocation
The JVM's initial allocation of memory is specified by -xms, which defaults to 1/64 of physical memory. The maximum allocated memory for the JVM is specified by -xmx, which defaults to 1/4 of physical memory. When the default free heap memory is less than 40%, the JVM increases the heap up to the maximum limit of -xmx. When the free heap memory is greater than 70%, the JVM reduces the heap up to the minimum limit of -xms. So the server typically sets -xms and -xmx equal to avoid resizing the heap after each GC.
Non-heap memory allocation
The JVM USES -xx: PermSize to set the initial value of non-heap memory, which is 1/64 of physical memory by default. Set the maximum size of non-heap memory by XX:MaxPermSize, which is 1/4 of physical memory by default.
JVM memory limit (maximum)
First, JVM memory is limited to the actual maximum physical memory (crap! Assuming that the physical memory is infinite, the maximum value of the JVM memory has a lot to do with the operating system. Simply put, although the 32-bit processor has 4GB of controllable memory space, the specific operating system will give a limit, which is generally 2gb-3gb (generally 1.5 g-2g for Windows, 2g-3g for Linux), and more than 64bit processor will not have a limit.
2. Why is it that on some machines I set both -xmx and -xx :MaxPermSize to 512M, Eclipse can be started, while on others it cannot?
From the previous introduction to JVM memory management, we learned that there are two types of JVM memory: heap memory and non-heap memory, and that the maximum JVM memory depends first on the actual physical memory and operating system. Therefore, there are mainly the following reasons for setting VM parameters to cause the program to fail to start:
1) the value of -xms in the parameter is greater than -xmx, or the value of -xx :PermSize is greater than -xx :MaxPermSize;
2) the value of -xmx and -xx: the sum of MaxPermSize exceeds the maximum JVM memory limit, such as the maximum memory limit for the current operating system, or the actual physical memory, and so on. One thing to note about actual physical memory is that if you have 1024MB of memory, you're not going to use 1024MB of memory on your actual system, because some of it is going to be taken up by hardware.
3. Why write the above parameters to the eclipse.ini file eclipse does not perform the corresponding Settings?
So why is the same argument valid on the shortcut or command line but not in the eclipse.ini file? This is because we did not follow the setting rules of the eclipse.ini file:
The parameter is in the form of "item value". If there is a space in the middle, it should be written on a new line. If there is a space in the value, it should be enclosed in double quotation marks. For example, we use -vm C:\Java\jre1.6.0\bin\javaw.exe to set the virtual machine.
- the vm
C: \ Java \ jre1.6.0 \ bin \ javaw exe
As mentioned above, the final parameter in eclipse.ini can be written like this:
- vmargs
- Xms128M
- Xmx512M
- XX: PermSize = 64 m
- XX: MaxPermSize = 128 m
The actual results can be viewed through the "Configuration Details" button in the "Help" - "About Eclipse SDK" window in Eclipse.
Note also that the Eclipse.ini file that comes with the Eclipse zip package looks like this:
- showsplash
Org. The eclipse platform
-- the launcher. XXMaxPermSize
256 m
- vmargs
- Xms40m
- Xmx256m
The meaning of the -xx :MaxPermSize parameter is basically the same as that of the -xx :MaxPermSize parameter. I think the only difference is that the former is the parameter set when eclipse. Exe is launched, while the latter is the parameter in the JVM used by eclipse. You can just set one of the two, so you can comment out the size and the next line with #.
3. Other startup parameters. If you have a dual-core CPU, maybe try this parameter:
- XX: + UseParallelGC
Allows GC to execute faster. (just the new parameters for GC added in JDK 5)

Related articles: