javaantairmxmlc

Java Heap Size amxmlc without ant


Out of the blue my build task for compiling my AIR application has stopped working:

/opt/flex-sdk/bin/amxmlc \
-optimize=true \
-define+=CONFIG::DEBUG,false \
-define+=CONFIG::RELEASE,true \
src/Main.as -output bin/Main.swf

Loading configuration file /opt/flex-sdk/frameworks/air-config.xml
Error: Java heap space

make: *** [bin/Main.swf] Error 1

Every mention of this on the internet is only applicable to building via ANT. I know I need to increase the heap size, but have no idea where to start.


Solution

  • After searching around all the config files, I realised that you can actually edit /opt/flex-sdk/bin/amxmlc, which in turn points to /opt/flex-sdk/bin/mxmlc (bottom of the file):

    VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false -Djava.util.Arrays.useLegacyMergeSort=true "
    
    java $VMARGS $D32 $SETUP_SH_VMARGS -jar "$FLEX_HOME/lib/mxmlc.jar" +flexlib="$FLEX_HOME/frameworks" "$@"
    

    As you can see, the VMARGS are directly set here to max the heap at 384m. My fix was to up this to 1024m and everything worked fine.