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.

About Eric Fickes

Independent Internet Consultant by day. Skateboarder, Bass player, Husband and Father by night. You can hire me to build internet powered solutions
This entry was posted in FLEX, osx and tagged , , , , , . Bookmark the permalink.

11 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. Pingback: Compiling using Ant in Flex Builder “Error: Java heap space” « The Morphic Group

  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!

  10. Nithya says:

    So simple …Thanks a lot!!!… :) it works fine

  11. Brett says:

    Thanks so much! It solves my problem

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>