Flex 4, Ant, and an OutOfMemoryError

I just started messing around with the new Flex 4 SDK beta, and man is it cool. The rework of the states system is reason alone to move now to Flex 4. Two-way data-binding, virtualization (I have not a clue as to what that means in Flex), and tons of other goodies look very promising for the Flex product line. Adobe, hats off to you for one-upping Flex 3, which indeed must have been a challenging feat.

Today, however, I ran into a problem with running the Flex MXMLC Ant task to compile my application. I kept getting a Java OutOfMemoryError whenever I’d try to compile. Initially, I wasn’t seeing this problem, but as my application got more complex, like it always does, I couldn’t be rid of the problem.

Luckily for you and I, a few people have run into this before and so I got a few pointers from a couple colleagues on how to work around the problem.

The first workaround I stumbled upon was a Windows-specific fix (for running ant from the command-line): http://n1aub0.cowurl.com | Apparently, you can set an environment variable “ANT_OPT” to include default JVM arguments when running Ant from the console.

The workaround that really fixed the problem for me in Eclipse was found on Sönke Rohde’s blog. Mad props to Sönke for finding a way to fix this. Again this fix isn’t something new to me, but it’s just nice to have these links laying around whenever you run into them. Adjusting Java’s memory size isn’t necessarily an “easy” thing to do, so it helps to have a reference.

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>