pfpflwho / java-ide-droid

Automatically exported from code.google.com/p/java-ide-droid
0 stars 0 forks source link

Out-of-memory condition when running dx on large projects #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to build JavaIDEdroid with JavaIDEdroid

What is the expected output? What do you see instead?
JavaIDEdroid crashes and in logcat you see that the reason was an out-of-memory 
condition during execution of dx.

Original issue reported on code.google.com by tom.ar...@gmail.com on 31 Oct 2011 at 6:46

GoogleCodeExporter commented 9 years ago
I was able to build a large project -- containing for example bsh.jar -- on the 
emulator using JavaIDE with the Dalvik heap limit raised to 64 Mb (from the 
default 16 or 24).  A root user might be able to effect this change on the real 
device.

Original comment by JeffreyR...@gmail.com on 9 Nov 2011 at 8:14

GoogleCodeExporter commented 9 years ago
I have a report from a user who has been able to augment the VM heap with 
BladeBuddy. After this, the dx out-of-memory exception did not occur any more 
for his project.
Unfortunately, this only works if you have root access.

Tom

Original comment by tom.ar...@gmail.com on 16 Jan 2012 at 10:06

GoogleCodeExporter commented 9 years ago
Is there anyone who can modify the dx code, so that it uses less memory?

From what I've seen, dx makes all its work in memory.
In com\android\dx\command\dexer\Main.writeDex() the data is all written to a 
byte[] and then written to the OutputStream. Maybe, we could write the data in 
smaller chunks and thus, save memory?

Tom

Original comment by tom.ar...@gmail.com on 16 Jan 2012 at 10:22

GoogleCodeExporter commented 9 years ago
In case useful, I can confirm the BladeBuddy report worked for me too.

(FYI: SGS2 150mm heap (up from 64mb) topped out at 115mb dexing of 396kb source 
and 1269kb of compressed JAR'd libraries in 103 seconds.)  I'm still 
geeking-out that this works -- including native library & RoboGuice.  thanks!

Original comment by Rupert....@gmail.com on 8 Feb 2012 at 9:07

GoogleCodeExporter commented 9 years ago
I am working on a new app called LibMinimizer.
It will allow to shrink the external Java libraries to their minimum and thus 
not solve but at least alleviate the problem.

Original comment by tom.ar...@gmail.com on 28 Mar 2012 at 6:14

GoogleCodeExporter commented 9 years ago
This problem is now solved with the new PRO version 1.6.0
It contains the DexMerger tool which can merge 2 dex files and the included dx 
is able to merge several dex archives (.dex.zip)

If a certain jar library is too large to dexify on the Android device, then 
dexify it on your PC and copy the dex archive to your device.

See the 1.6.0 help file for more details.

Tom

Original comment by tom.ar...@gmail.com on 11 Oct 2012 at 10:20