Search code examples
javaflashubuntujvmmxmlc

Invalid heap size: where it is taken from?


Executing one of the ant tasks, which launches mxmlc (which in turn uses JVM). I am getting the following output:

build-swf:
     [exec] Current OS is Linux
     [exec] Executing '/usr/local/flex_sdk_3/bin/mxmlc' with arguments:
     [exec] '/home/user/dev/branch/flash/FLA/layer.as'
     [exec] '-output'
     [exec] '/home/user/dev/branch/flash/bin-release/layer.swf'
     [exec] '-compiler.source-path'
     [exec] '/home/user/dev/branch/flash/FLA'
     [exec] '-compiler.library-path'
     [exec] '/usr/local/flex_sdk_3/frameworks/libs'
     [exec] '-default-background-color=0xFFFFFF'
     [exec] '-locale'
     [exec] 'en_US'
     [exec] '-compiler.library-path'
     [exec] '/usr/local/flex_sdk_3/frameworks/locale/en_US'
     [exec] '-incremental'
     [exec] '-optimize=true'
     [exec] '-target-player=10'
     [exec] '-use-network=true'
     [exec] '-warnings=false'
     [exec] '-define=CONFIG::commercial,false'
     [exec] 
     [exec] The ' characters around the executable and arguments are
     [exec] not part of the command.
     [exec] Invalid maximum heap size: -Xmx384m -Dsun.io.useCanonCaches=false
     [exec] Could not create the Java virtual machine.

By googling on the error message, I've realized that the heap size for the jvm was not set correctly. Tried to examine my environment variables by grep-ing "384" or "java" but got nothing. Where are those parameters taken from?


Solution

  • The number comes from the mxmlc script itself (mxmlc is actually a shell script):

    # don't use $FLEX_HOME in this variable because it may contain spaces,
    # instead put it on the java args directly, with double-quotes around it
    VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false"
    
    java $VMARGS -jar "$FLEX_HOME/lib/mxmlc.jar" +flexlib="$FLEX_HOME/frameworks" "$@"
    

    I'm not sure why you'd get invalid maximum heap size. It appears as if the entire $VMARGS variable is getting passed in as a single variable. What kind of shell are you using?