Why Does FDT Show A Java Heap Error While Packagin

2019-06-14 01:47发布

问题:

I'm creating some flash game using Adobe AIR. I try to compile it into .ipa file (to run on iPad device).

The project is not big, but not small also (it uses 6 swc libraries and lot's of not precompiled code). I try to package my game with Flash FDT 5.5 using both methods:

  • fast - works ok, but the performance is terrible;
  • standard - my compilation finishes with following error:

Packaging failed! Packaging error message: Picked up JAVA_TOOL_OPTIONS: -Xmx3072M Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.TreeMap.put(Unknown Source) at adobe.abc.Algorithms$SetMap.get(Algorithms.java:225) at adobe.abc.Algorithms.addUses(Algorithms.java:164) at adobe.abc.Algorithms.findUses(Algorithms.java:186) at adobe.abc.GlobalOptimizer.cp(GlobalOptimizer.java:9381) at adobe.abc.GlobalOptimizer.dce(GlobalOptimizer.java:9627) at adobe.abc.GlobalOptimizer.sccp(GlobalOptimizer.java:4638) at adobe.abc.GlobalOptimizer.optimize(GlobalOptimizer.java:3514) at adobe.abc.GlobalOptimizer.optimize(GlobalOptimizer.java:2215) at adobe.abc.LLVMEmitter.optimizeABCs(LLVMEmitter.java:527) at adobe.abc.LLVMEmitter.generateBitcode(LLVMEmitter.java:337) at com.adobe.air.ipa.AOTCompiler.convertAbcToLlvmBitcodeImpl(AOTCompiler.java:510) at com.adobe.air.ipa.BitcodeGenerator.main(BitcodeGenerator.java:80) Picked up JAVA_TOOL_OPTIONS: -Xmx3072M Compilation failed while executing : ADT Picked up JAVA_TOOL_OPTIONS: -Xmx3072M Picked up JAVA_TOOL_OPTIONS: -Xmx3072M

I know that this is common issue with Eclipse devlopment. I tried to solve that in standard way -> increase java heap size. As you can see I've set 3072M which should be sufficient.

When I try to compile smaller projects it works fine. I've got no idea what to do now :(. Any ideas?

回答1:

After deep investigation I've found a solution. It was NOT due to any enviromnent configuration, but, as @Alan said, Adobe's packager was running into problems. As I suppose, it was meeting problems while 'optimalization' phase.

Here's a forum topic that was really usefull: http://forums.adobe.com/message/4445973#4445973

My project was using NAPE physic engine. As I found there: http://deltaluca.me.uk/forum/index.php/m/2148/0ce4c49cc2c79979154c56737d2978a4/ people meet problems with compilation time. In my case the compilation time was infinity ;), what ended with java's out of memory exception. The solution was to use newest NAPE build, which was a little bit optimalized by the author. This 'small optimalization' made my project working.

To sum up: if you have similiar problem, just check your code. Try to find some huge functions/methods, which Adobe's packager finds hard to optimalize.



回答2:

The -Xmx3072M is not a valid Eclipse argument. Restore your 'eclipse.ini' settings and other Java settings to the defaults and it should work. You might be setting it so high that other parts of the JVM run out of memory.

As can been seen by the stack trace, it's not an Eclipse or FDT issue. Adobe's packager is running into problems. If the default still doesn't work, then see about giving Java in general more memory. If that doesn't work, slowly increment Eclipse's memory to see if that works.