Eclipse.ini's related notes

Source: Internet
Author: User
Tags xms

Http://www.cnblogs.com/yan5lang/archive/2011/05/24/2055867.htmlEclipse startup is controlled by $eclipse_home/eclipse.ini, if $ Eclipse_home is not defined, the default Eclipse.ini under the Eclipse installation directory will take effect.

Eclipse.ini is a text file whose content is equivalent to the command-line arguments that were added to Eclipse.exe after Eclipse was run.

Its format requirements:

1: All options and their associated parameters must be within a single line

2: All parameters after-vmargs will be passed to the JVM, all if all parameters set on Eclipse must be written before-vmargs (as you would with these parameters on the command line)
By default, the contents of Eclipse.ini are as follows:

-showsplash
Org.eclipse.platform
--launcher. Xxmaxpermsize
256m
-vmargs
-xms40m
-xmx256m

The above configuration indicates that the initial heap space size is 40M and the maximum is 256m,permgen maximum is 256M.

Specify a virtual machine

It is recommended that you use Eclipse.ini to specify a certain JVM instead of using the default, because in many cases you cannot confirm which JVM your eclipse is using on your machine, and use Eclipse.ini to specify that you can specify and confirm it.

The following example shows how to use the-VM option correctly

Note The format of the-VM option is strictly required:
The 1:-VM option and its value (path) must be on a separate line
2: The value must be strictly directed to the Java executable, not just the Java home directory.
The 3:-VM option must have been mentioned before the-vmargs option, and all options after-vmargs will be passed directly to the JVM

Windows Example

-showsplash
Org.eclipse.platform
--launcher. Xxmaxpermsize
256m
-vm
C:\Java\JDK\1.5\bin\javaw.exe
-vmargs
-xms40m
-xmx512m

Linux Example

In the Linux operating system, the format is similar to that in Windows

-showsplash
Org.eclipse.platform
--launcher. Xxmaxpermsize
256m
-vm
/opt/sun-jdk-1.6.0.02/bin/java
-vmargs
-xms40m
-xmx512m

Mac OS X Example

Specify Java 6:

-showsplash
Org.eclipse.platform
--launcher. Xxmaxpermsize
256m
-vm
/system/library/frameworks/javavm.framework/versions/1.6.0/home/bin/java
-vmargs
-xms40m
-xmx512m


Heap and non-heap (non-heap) memory
According to the official statement, "Java virtual machines have a heap, the heap is a runtime data region, and all class instances and arrays of memory are allocated from here." Heap is in Java
Created when the virtual machine is started. "" The memory outside the heap in the JVM is called non-heap (non-heap memory) ". You can see that the JVM primarily manages two types of memory: heap and non-heap.
Simply put, the heap is Java code memory, is left to developers to use;
A non-heap is a JVM left to itself, so the method area, the JVM internally processes or optimizes the required memory (such as the JIT-compiled code cache), each class structure (such as running a constant pool, field, and method data), and methods and construction methods
The code is in non-heap memory.
Heap memory allocation:
The initial memory allocated by the JVM is specified by-XMS, which defaults to 1/64 of the physical memory;
The maximum allocated memory for the JVM is specified by-XMX, which defaults to 1/4 of the physical memory.
When the default free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of-xmx;
When free heap memory is greater than 70%, the JVM will reduce the heap until the minimum limit of-XMS.
So the server generally sets-xms,-xmx equal to avoid resizing the heap after each GC.

Non-heap memory allocations:
The JVM uses-xx:permsize to set the non-heap memory initial value, which defaults to 1/64 of the physical memory;
The maximum amount of non-heap memory is set by Xx:maxpermsize, which defaults to 1/4 of physical memory.

JVM Memory Limit (max)
First, the JVM memory is limited to the actual maximum physical memory, assuming that the physical memory is infinitely large, the maximum value of the JVM memory is very much related to the operating system.
Simply put, 32-bit processor Although the controllable memory space has 4GB, but the specific operating system will give a limit, this limit is generally 2GB-3GB (generally
Under Windows, the 1.5g-2g,linux system is 2g-3g), and processors over 64bit are not limited.

Setting the VM parameters causes the program to fail to start for several reasons:
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 sum of-XMX values and-xx:maxpermsize exceeds the maximum limit of JVM memory, such as the maximum memory limit of the current operating system, or actual physical memory, and so on.
When it comes to physical memory, it is important to note that if your memory is 1024MB, the actual system is not likely to be 1024MB, because a portion of it is consumed by the hardware.

Why is the above parameter written to the Eclipse.ini file eclipse does not perform the corresponding setting?
Why is the same argument valid on a shortcut or command line and is not valid in the Eclipse.ini file? This is because we have not complied with the setup rules for Eclipse.ini files:
Parameter shape such as "Item Value" In this form, there are spaces in the middle of the need to write a newline, if there are spaces in the value need to be enclosed in double quotation marks. For example, we use-VM
The C:\Java\jre1.6.0\bin\javaw.exe parameter sets the virtual machine to be written in the Eclipse.ini file:
-vm
C:\Java\jre1.6.0\bin\javaw.exe

As stated above, the final parameter can be written in Eclipse.ini:
-vmargs
-xms128m
-xmx512m

-xx:permsize=64m
-xx:maxpermsize=128m
The results of the actual operation can be achieved through eclipse
"Help"-the "Configuration Details" button in the About Eclipse SDK window to view.
Also need to explain
, the contents of the Eclipse.ini file included in the Eclipse compact package are as follows:
-showsplash
Org.eclipse.platform

--launcher. Xxmaxpermsize
256m
-vmargs
-xms40m
-xmx256m

Which –launcher. Xxmaxpermsize (Note that the front is two cable) the meaning of the-xx:maxpermsize parameter is basically the same, I
The only difference is that the former is the parameter set when the Eclipse.exe is started, and the latter is the parameter in the JVM used by Eclipse. Actually the two set one on it, so
Here you can put –launcher. Xxmaxpermsize and Next line use # comment out.

The other startup parameters. If you have a dual-core CPU, you might be able to try this parameter:
-xx:+useparallelgc
Allows the GC to execute faster.

Eclipse.ini's related notes

Related Article

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.