When I was working on the project, myeclipse prompts that the memory is insufficient. I have 1 GB of memory.
The error message is as follows:
Myeclipse has detected that less than 5% of the 64 MB of perm
Gen (non-heap memory) space remains. It is stronugly recommended
That you exit and restart myeclipse with new virtual machine memory
Paramters to increase this memory. Failure to do so can result in
Data loss. The recommended eclipse memory parameters are:
Eclipse.exe-vmargs-xms128m-xmx512m-XX: permsize = 64 m-XX: maxpermsize = 128 m
The following are parameters of my myeclipse shortcut:
"D:/eclipse 3.2.2/eclipse.exe"-product COM. genuitec. myeclipse. product. IDE-vmargs-duser. language = EN-xms128m-xmx512m-XX: permsize = 64 m-XX: maxpermsize = 128 M-dosgi. splashlocation = "D:/myeclipse 5.0ga/Eclipse/myeclipsesplash.bmp"
For myeclipse, you can directly modify the myeclipse shortcut parameters on the desktop. The meaning of these parameters is explained now.
-Vmargs: Specifies the VM parameters.
-Xms40m: the virtual machine occupies the Minimum Memory of the system.
-Xmx256m: the virtual machine occupies the maximum memory of the system.
-XX: permsize: Minimum heap size. When insufficient memory is reported, this is too small,
If the remaining heap space is less than 5%, a warning is reported. We recommend that you set this parameter slightly.
Larger, but it depends on the memory size of your machine.
-XX: maxpermsize: Maximum heap size. This should also be larger.
-5% of xmx512m is 25.6 m. Theoretically, the value of-xmx and-XX: maxpermsize must be greater than 25.6 m.
Change the parameters in
-Vmargs
-Xms128m
-Xmx512m
-XX: permsize = 128 m
-XX: maxpermsize = 256 m
So for me, I just need to change myeclipse5.0 to-XX: permsize = 128m-xx: maxpermsize = 256 m. The problem is solved!
Eclipse startup parameter settings
Right-click the eclipse shortcut and enter the following content in "target ".
D:/Eclipse/eclipse.exe-Debug options-VM javaw.exe-nl en_us-clean-vmargs-xverify: None-XX: + useparallelgc-XX: permsize = 20 m-XX: maxnewsize = 32 m-XX: newsize = 32 m-xms128m-xmx256m
Parameter annotation:
[-Debug options-VM javaw.exe] displays the current JVM memory usage (NOTE: For details, see "Show your eclipse JVM current memory usage" below).
[-Nl] language: English en_us Simplified Chinese zh_cn
[-Clean] clears the buffer when Eclipse IDE is started. In general, removing this parameter is faster without updating the plug-in.
-Vmargs: Use the JRE parameter, followed by the JRE parameter:
[-Xverify: None] Remove the jar package data verification. Generally, you only need to verify the jar package data validity in the network environment. You do not need to verify it locally.
[-XX: + useparallelgc] uses the parallel garbage collection mechanism. It is said that this GC algorithm is faster. The details are unclear.
[-XX: permsize = 20 m-XX: maxnewsize = 32 m-XX: newsize = 32 m] These three parameters are used to set detailed buffer data. For more information, see the introduction on the official Java website.
-Xms128m: memory size initialized by the Java Virtual Machine.
[-Xmx256m] The maximum memory usage of the Java Virtual Machine is set according to the content size of the machine you are using, as long as the maximum memory capacity is not exceeded.
Let your eclipse show the current JVM memory usage
1. Create a file named options in the eclipse root directory. The file content is org. Eclipse. UI/perf/showheapstatus = true.
2. Run this command to start Eclipse: D:/Eclipse/eclipse.exe-Debug options-VM javaw.exe.
Alternatively, right-click the eclipse shortcut and enter this line in "target.
3. Start eclipse and you will see the following status bar showing the current JVM memory usage. In addition, you can force garbage collection.
Note that you must note the backup before modifying the INI file.
The startup parameters are the same as those written in ini. They are all startup configurations.
The order in which eclipse loads JRE: first run the-VM parameter. If no-VM parameter is available, find the eclipse/JRE subdirectory. If no-VM parameter is available, eclipse finally finds the JRE registered in the system.
Eclipse. ini memory settings
-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 are actually JVM parameters. First, let's take a look at the JVM memory management mechanism, and then explain the meaning of each parameter.
Heap and non-heap memory
According to the official statement: "A Java 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. The heap is created when the Java Virtual Machine is started ." "Memory outside of the heap in JVM is called non-heap 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. Non-heap is reserved for JVM, therefore, the method area, JVM internal processing or optimization of the required memory (such as the code cache after JIT compilation), each class structure (such as the runtime data pool, field and method data) the methods and constructor code 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. 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.
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 has a controllable memory space of 4 GB, the specific operating system will impose a limit, this limit is generally 2 GB-3 GB (1.5 GB-2 GB in windows and 2 GB-3 GB in Linux ), the 64-bit and above processors 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 the actual physical memory, it should be noted that if your memory is 1024 MB, but it is not likely to be 1024 MB in the actual system, 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:
Parameters are in the form of "item value". If there is a space in the middle, you need to wrap it. If there is a space in the value, you need to include it in 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)
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/xenron/archive/2010/03/17/5388069.aspx