Details of ini settings under eclipse

Under Ubuntu system, eclipse configuration file:

Here are a few questions:

1. What is the meaning of each parameter?

2. Why do some machines set - Xmx and - XX: maxpermsize to 512M, and then eclipse can start, while some machines can't start?

3. Why write the above parameters to eclipse INI file eclipse does not implement the corresponding settings?

1. What is the meaning of each parameter?

In the parameters - vmargs means to set JVM parameters, so the following are actually JVM parameters. Let's first understand the mechanism of JVM memory management, and then explain the meaning represented by each parameter.

Heap and non heap memory

According to the official saying, "the Java virtual machine has a heap, which is the runtime data area from which the memory of all class instances and arrays is allocated. The heap is created when the Java virtual machine is started. In the JVM, the memory outside the heap is called non heap memory". As you can see, the JVM mainly manages two types of memory: heap and non heap

In short: heap is the memory accessible to Java code, which is reserved for developers; Non heap is reserved by the JVM for its own use, so the method area, the memory required for processing or optimization within the JVM (such as JIT compiled code cache), each class structure (such as runtime constant pool, field and method data), and the code of methods and construction methods are all in non heap memory.

Heap memory allocation

The memory initially allocated by the JVM is specified by - XMS, which is 1 / 64 of the physical memory by default; The maximum memory allocated by the JVM is specified by - Xmx, and the default is 1 / 4 of the physical memory. When the default free heap memory is less than 40%, the JVM will increase the heap to the maximum limit of - Xmx; When the free heap memory is greater than 70%, the JVM reduces the heap to the minimum limit of - XMS. Therefore, the server generally sets -Xms and -Xmx equal so as to avoid adjusting the heap size 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 the physical memory by default; Set the maximum non heap memory size by XX: maxpermsize. The default is 1 / 4 of the physical memory.

JVM memory limit (maximum)

First, the JVM memory is limited to the actual maximum physical memory (memory module). Assuming that the physical memory is infinite, the maximum value of JVM memory has a great relationship with the operating system. In short, for 32-bit processors, although the controllable memory space has 4GB, the specific operating system will give a limit, which is generally 2gb-3gb (generally 1.5G-2G under Windows system and 2g-3g under Linux system), while there will be no limit for processors above 64bit.

2. Why do I set - Xmx and - XX: maxpermsize to 512M for some machines, and then eclipse can start, while some machines can't start?

Through the above introduction to JVM memory management, we have learned that JVM memory includes two types: heap memory and non heap memory. In addition, the maximum memory of JVM first depends on the actual physical memory and operating system. Therefore, setting VM parameters makes the program unable to start, mainly for the following 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 and - XX: maxpermsize exceeds the maximum memory limit of the JVM, such as the maximum memory limit of the current operating system or the actual physical memory. When it comes to the actual physical memory, it should be noted that if your memory is 1024MB, it cannot be used in the actual system, because some of it is occupied by hardware.

3. Why write the above parameters to eclipse INI file, eclipse does not execute the corresponding settings?

Why are the same parameters valid in shortcuts or command lines and not in eclipse INI file is invalid? This is because we did not comply with eclipse INI file setting rules:

The parameter is in the form of "item value". If there is a space in the middle, it needs to be written on a new line. If there is a space in the value, it needs to be enclosed in double quotation marks. For example, we use - VM C: \ Java \ jre1 6.0\bin\javaw. Exe parameter to set the virtual machine in eclipse. Exe The INI file should be written as follows:

-vm

C:\Java\jre1. 6.0\bin\javaw. exe

As mentioned above, the final parameters are in eclipse Ini can be written like this:

The actual running results can be viewed through the "configuration details" button in the "help" - "about eclipse SDK" window in eclipse.

In addition, it should be noted that the built-in eclipse The contents of the INI file are as follows:

Among them, clauscher XXMaxPermSize (note that the first two connecting lines) 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 started, and the latter is the parameter in the JVM used by eclipse. In fact, you can set one of the two, so you can use # comment out clauscher.xxmaxpermsize and the next line here.

4. Other startup parameters.

If you have a dual core CPU, maybe you can try this parameter:

-XX:+UseParallelGC

Enable GC to execute faster (only the newly added parameters for GC in JDK 5)

eclipse. Ini example (16g physical memory):

Eclipse error log directory: find the workspace you specified - > Metadata->. log

summary

The above is the details of ini settings under eclipse introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>