Original URL: http://blog.csdn.net/zengyangtech/article/details/7003379
Welcome reprint, Reprint please specify http://blog.csdn.net/zengyangtech/article/details/7003379
Today, I had a problem compiling a big project.
Unable to execute Dex:java heap space
Search the Internet for a while, there are two kinds of solutions:
1. Eclipse.int Add Memory
2. Import the jar of the project through the Add User library mode
Right-click Project->build path->add library->user library->user libraries->new-> Pick a name->add JARs->ok
Remember to select User Systemlibrary during the add process
Eclipse.ini
[Java]View Plaincopy
- -startup
- Plugins/org.eclipse.equinox.launcher_1. 0.201.r35x_v20090715.jar
- --launcher.library
- Plugins/org.eclipse.equinox.launcher.win32.win32.x86_1. 0.200.v20090519
- -showsplash
- Org.eclipse.platform
- --launcher. Xxmaxpermsize
- 256m
- -vmargs
- -xms40m
- -xmx256m
The relevant parameters can be configured directly below
The-vmargs in the
parameter means that the JVM parameters are set, so the following are all the parameters of the JVM, and we'll first look at the mechanism of the JVM's memory management, and then explain what each parameter means.
Heap and non-heap (non-heap) memory
Officially, the Java virtual machine has a heap, the heap is a runtime data region, and the memory of all class instances and arrays is allocated from here. The heap is created when the Java 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. In a nutshell, a heap is a Java code-readable memory that is left to the developer, not a heap, which is left to itself by the JVM, 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 the code for methods and construction methods are in non-heap memory.
Heap memory allocation
The initial allocation of memory by the JVM is specified by-XMS, which defaults to the 1/64;JVM maximum allocated memory for physical memory 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 increases the heap until the maximum limit of-xmx, and when the free heap memory is greater than 70%, the JVM reduces the heap until the minimum limit of-XMS. So the server generally sets-xms,-xmx equal to avoid resizing the heap after each GC. the
non-heap memory allocation
JVM uses-xx:permsize to set the non-heap memory initial value, which is 1/64 of physical memory by default, and the maximum amount of non-heap memory 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 maximum amount of physical memory is large, the JVM memory Max is related to the operating system. In short, the 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 (typically under Windows systems for the 1.5g-2g,linux system 2g-3g), and processors over 64bit are not limited.
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 the-VM C:\Java\jre1.6.0\bin\javaw.exe parameter to set up the virtual machine, in the Eclipse.ini file to write this:
-vm
C:\Java\jre1.6.0\bin\javaw.exe
Which –launcher. Xxmaxpermsize (Note that the front is two connectors) the meaning of the-xx:maxpermsize parameter is basically the same, the 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.
Original URL: http://blog.sina.com.cn/s/blog_721d87eb0100sf0r.html
Today when doing launcher transplant unable to execute Dex:java heap space error, on-line received a solution, the problem solved, now to solve the method to say:
There are two ways: the first is to modify the denomination Eclipse.ini file in the Eclipse directory to add the first line-vmc:\program Files\java\jdk1.6.0_24\bin\javaw.exe (your JDK directory) Modify-xms128m-xmx512m Modify--launcher.xxmaxpermsize512m The second solution is to add the user library and select the As System library and introduce the project. (This method is not verified) original URL: http://my.oschina.net/zhouruotong/blog/75272
Added a few jar,eclipse to be stuck, and finally jumped out:
The reason is that the addition of a few larger jars causes eclipse memory to be insufficient, when we need to add the jar (select User systemlibrary).
"Go" unable to execute Dex:java heap space solution (how to add memory for Eclipse.int)