Unable to execute Dex:java heap space is now in the process of packaging Android, share the solution today
上网找了一下,有两种解决方案:
1.Eclipse.intAdd memory2. of the Import ProjectJarPassAdd User LibraryMode import right-click Project -Build Path -Add Library -User Library -User Libraries -New -Pick a name. -Add JARs -OKDuring the add process, remember toUser systemlibrarySelected
One of the first methods I've tried will be in Eclipse.ini
–launcher. Xxmaxpermsize
512m (This modification to refer to the physical memory size of the machine), the following will be attached eclipse.ini the meaning of the parameters;
Focus on the second type:
Start by following the online correct add user library and set as User System library, as well as to the needs of the project to the unwanted Association library to remove
The main reason for the unable to execute Dex:java heap space is that the JVM load jar package consumes a large amount of allocated memory
Eclipse.ini
-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 is to set the JVM parameters, so the following is actually the JVM parameters, we first understand the JVM memory management mechanism, and then explain the meaning of each parameter represents.
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." 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 memory allocated by the JVM is specified by-XMS, the default is physical memory 1/64;JVM the maximum allocated 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.
Non-heap memory allocation
The JVM uses-xx:permsize to set the non-heap memory initial value, which defaults to 1/64 of the physical memory, and the maximum non-heap memory by Xx:maxpermsize, which by default is 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. 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.
Modifying Eclipse.ini is mainly the following points:
Modified Eclipse.ini File Contents:
-vm-startupplugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar--launcher.libraryplugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140116-2212-showsplashorg.eclipse.platform--launcher.XXMaxPermSize256m--launcher.defaultActionopenFile--launcher.appendVmargs-vmargs-Xms128m-Xmx1024m
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Unable to execute Dex:java heap space error resolution