Friday, November 06, 2009

Eclipse, Ant and java.lang.OutOfMemoryError

Launching Ant builds from Eclipse sometimes gives following error

[javac] Compiling 941 source files to C:\xxx
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
...

After a bit of Google and experimentation, this is what works for me. Basically changed the JRE settings to use a bigger chunk of memory (Go to Window ->Preferences ->Installed JREs -> Default JRE -> Edit) for heap and stack like

-Xms256m -Xmx512m -Xss1m -XX:MaxPermSize=128m

No comments: