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.
- Run Menu > External Tools > Open External Tools Dialog…
- Select your Ant build file on the left
- Click the JRE tab on the right
- Enter “-Xmx640m” in the VM arguments field ( without quotes )
- Click Apply, then Run

Flex JRE preferences
Hopefully this will get you going.

Thanks a lot. It worked for me.
Sweet! Thanks for stopping by surendra.
Works for me too – cheers Eric.
Sweet Josh! Now get back to coding
this helped me. thanks!
I'm glad I could help Ashier.
Pingback: Compiling using Ant in Flex Builder “Error: Java heap space” « The Morphic Group
It is nice to see this site is finally getting the attention that it deserves! Keep up the great work.
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!
So simple …Thanks a lot!!!…
it works fine
Thanks so much! It solves my problem