A lot of people get this OutOfMemory error, even with small projects. If you google there are a lot of pages that tell you what to do, there are two pitfalls however. Under Windows you need to edit catalina.bat NOT catalina.sh! And second, if you found entry about it and still wondering why it doesn’t work, there’s two typos, the quotes are wrong. Here is the correct version:
set "JAVA_OPTS=-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
Funny note: When not using those options the Java process would immediately claim 1.6GB of memory (got a 64bit version of Server 2kR2 with 32GB RAM here) and it still crashed on the first build. Now with the very low memory settings from this example the Java process only uses 600MB of memory and it doesn’t crash. Gotta love Java.