Set the ANT_OPT for flex ant tasks to avoid the error “out of memory” threw by Flex Builder when building a huge project

memory Problem Summary: When I compile a project including thousands MXML and AS files with Flex Ant, I got an error message as below displayed in the Console panel of Flex Builder:

java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap.resize(Unknown Source)
at java.util.HashMap.addEntry(Unknown Source)

It seems that the memory usage of my JRE reaches its limitation — as we know, Flex Builder is running in JRE. Here is a simple way to solve this problem. It‘s just changing the preferences settings of Flex Builder.

Solution Summary: There are two useful arguments of JRE to control the memory usage:

-Xms define the minimum usage of memory by JRE
-Xmx define the maximum usage of memory by JRE

I just set –Xmx to 1024m to satisfy the usage of compiling such huge Flex project.

With Flex Builder, point to the menu “Windows” at the top and open the “Preferences” dialog.
Preferences

Preferences-01

Expand the left tree as this: Java->Installed JREs. Then select the JRE being used and click Edit to open the “Edit JRE” dialog.

Preferences-02

Then, set the Default VM arguments as “-Xmx1024m” to enlarge the memory usage limitation.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • Technorati
  • StumbleUpon
  • Twitter
RSS Enjoy this Post? Subscribe to Ntt.cc

RSS Feed   RSS Feed     Email Feed  Email Feed Follow us Follow us
You can leave a response, or trackback from your own site.

2 Responses to “Set the ANT_OPT for flex ant tasks to avoid the error “out of memory” threw by Flex Builder when building a huge project”

  1. [...] public links >> xms Set the ANT_OPT for flex ant tasks to avoid the error “out of memory” threw by Flex Builder when… Saved by MrEARSking on Thu 06-11-2008 XMS FTW Saved by onaboy on Sun 02-11-2008 NE YO Lawyer [...]

  2. martina19002003 says:

    I have been searched a solution for 3 days.
    Thank you very much!

Leave a Reply