OSX FlexBuilder Java Heap Space error

Here’s an error I’ve run into from time to time while programming Flex on OSX

	[compc] Error: Java heap space
	[compc] java.lang.OutOfMemoryError: Java heap space	

This error was a real pain in the arse. I found a lot of people having similar issues and they all fixed this problem by setting ANT_OPTS as an environment variable to increase the memory size. This didn’t work for me. I set ANT_OPTS in my .profile, as well as in .MacOSX/environment.plist.  No luck.  I never figured out why the environment variable route didn’t work, but I was able to fix this error within Eclipse.

If you run into this error while running Ant build scripts, try the following steps.

  1. Run Menu > External Tools > Open External Tools Dialog…
  2. Select your Ant build file on the left
  3. Click the JRE tab on the right
  4. Enter “-Xmx640m” in the VM arguments field ( without quotes )
  5. Click Apply, then Run
Flex JVM preferences

Flex JRE preferences

Hopefully this will get you going.

Tags: , , , , ,

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

9 Responses to “OSX FlexBuilder Java Heap Space error”

  1. surendra says:

    Thanks a lot. It worked for me.

  2. Eric says:

    Sweet! Thanks for stopping by surendra.

  3. Works for me too – cheers Eric.

  4. Eric says:

    Sweet Josh! Now get back to coding :)

  5. Ashier says:

    this helped me. thanks!

  6. Eric Fickes says:

    I'm glad I could help Ashier.

  7. [...] involves changing a particular property in Flex Builder. I really should thank Eric Fickes for his blog on this issue on Mac.  My solution is for [...]

  8. It is nice to see this site is finally getting the attention that it deserves! Keep up the great work.

  9. ciroppina says:

    If You are experiencing a message "Error: Java Heap Space" when building Falsh Builder 4 Workpace, or cleaning projects, or generating bin-Relase (expecially for AIR) or launching a Flex App (sdk 3/4) from the IDE

    here You are the solutions:

    There are two reasons:

    a) Flash Builder 4 IDE (Eclipse+Equinox) memory is finshed!
    b) Run/Debug actions memory in finished!

    Solutions

    Solution for case a):
    - Go to Flash Builder 4 install_dir
    - edit file: FlashBuilder.ini
    - increase the following parameters, as follows (or more, depening on system available RAM memory):
    -Xms256m -> -Xms384m
    -Xmx384m -> -Xmx512m
    [if the previous 2 parms are absent, add them to the file, one for line]
    - save, close file .ini editing
    - restart Falsh Builder 4

    Solution for case b):
    - Go to each of two /sdks folders, both 3.5 and 4.0, then enter subfolder /bin
    - edit files: jvm.config
    - modufy args on the line java.args= as follows (or more):
    from: -Xmx256m -Dsun.io.useCanonCaches=false
    to: -Xms384m -Xmx512m -Dsun.io.useCanonCaches=false
    - save, close editing of jvm.config files
    - restart Falsh Builder 4

    Tha's all folks!

Leave a Reply