kamcknig
kamcknig

Reputation: 945

Can't seem to increase java heap size on intellij in windows

I have an Android Flex/AIR application I'm developing in Intellij 2017. When I try to debug it on my phone I keep getting the out of memory error.

dx tool failed:
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
    at java.util.BitSet.initWords(BitSet.java:166)
    at java.util.BitSet.<init>(BitSet.java:161)
    at com.android.dx.ssa.SsaBasicBlock.<init>(SsaBasicBlock.java:128)
    at com.android.dx.ssa.SsaBasicBlock.newFromRop(SsaBasicBlock.java:147)
    at com.android.dx.ssa.SsaMethod.convertRopToSsaBlocks(SsaMethod.java:173)
    at com.android.dx.ssa.SsaMethod.newFromRopMethod(SsaMethod.java:103)
    at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:44)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:98)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:297)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
    at com.android.dx.command.dexer.Main.processClass(Main.java:734)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:678)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:607)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:637)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:511)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:281)
    at com.android.dx.command.dexer.Main.run(Main.java:247)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

It shows me the command being used:

DT command line: D:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\jre64\bin\java.exe .... ... -Xmx512m -jar ... ... 

Erased most, but it shows that it's using 512m for the memory. I have gone into the compiler settings and set the "Build process heap size" option to 2056 but that hasn't helped. I've also added the JAVA_OPTS variable with a value of "-Xms128 -Xmx2056m"

I'm not sure what where Intellij is getting that setting to change it.

Any help is appreciated, thanks

EDIT

Here is the original command that gets run, and no matter what I've tried so var it always says -Xmx512m

D:\<path_to_intellij>\java.exe -Dapplication.home=D:\<path_to_flex_sdk> -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Duser.language=en -Duser.region=en -Xmx512m -jar D:\<path_to_flex_sdk>\lib\adt.jar -package -target apk-debug -listen 7936 -storetype PKCS12 -keystore D:\<path_to_key_file> -storepass <password> D:\<output_path>\GROL.apk

EDIT 2

If I take the command given from the Intellij IDEA and run it manually on the command line and change the 512 to something higher it works. There just seems to be no setting in IntelliJ for this particular action. I'll have to post on the IntelliJ forums and maybe get some dev help over there. If they respond, I'll answer it on here

Upvotes: 1

Views: 1868

Answers (2)

CrazyCoder
CrazyCoder

Reputation: 402463

You can change it here (Actionscript & Flex Compiler heap size):

flex heap

Upvotes: 1

JUAN CALVOPINA M
JUAN CALVOPINA M

Reputation: 3984

You can add this settings from IntelliJ menu bar, go to Help > Edit Custom VM Options..., this will create a copy of your existing /bin/idea.exe.vmoptions or /bin/idea64.exe.vmoptions file from the installation folder and it will open to edit.

You can use -Xms<initial heap size> -Xmx<maximum heap size>, for example, the final file should look like:

# custom IntelliJ IDEA VM options

-Xms750m
-Xmx2048m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops

For the changes to take effect it is necessary to restart IntelliJ

Another alternative is settings the size in the Run/Debug configurations option, for to do that go to menu bar Run > Edit Configurations..., and add -Xms750m -Xmx2048m in VM Options field

Upvotes: 0

Related Questions