OutOfMemoryException when trying to build JastAddJ
Up to Troubleshooting
OutOfMemoryException when trying to build JastAddJ
Hi! 
I've been trying to compile the JastAdd java compiler unsuccesfully
I've downloaded it from svn properly, but when i try to run >ant on each of the directories, i get an OutOfMemoryException. I've already tried running it from Eclipse, increasing the -vmargs memory arguments, but i still get the same message.
Here's what I get, whenever I try to run the 'gen' ant task from eclipse:
scanner:
[concat] Binary concatenation of 11 resources to ..\JastAddJavaCompiler\Java1.4Frontend\scanner\JavaScanner.flex
[jflex] Generated: JavaScanner.java
parser:
[concat] Binary concatenation of 3 resources to ..\JastAddJavaCompiler\Java1.4Frontend\parser\JavaParser.all
[java] Parser specification parser/JavaParser.beaver generated from parser/JavaParser.all
[beaver] JavaParser.beaver: Warning: Resolved Shift-Reduce conflict by selecting (RPAREN: SHIFT; goto 278) over (RPAREN: REDUCE postfix_expression = name.n) using precedence.
[beaver] JavaParser.beaver: Warning: Resolved Shift-Reduce conflict by selecting (RPAREN: SHIFT; goto 480) over (RPAREN: REDUCE postfix_expression = name.n) using precedence.
[beaver] JavaParser.beaver: 0 errors, 2 warnings.
[beaver] JavaParser.beaver: Generated: JavaParser.java
gen:
[jastadd] generating node types and weaving aspects
BUILD FAILED
..\JastAddJavaCompiler\Java1.4Frontend\build.xml:33: java.lang.OutOfMemoryError: Java heap space
Does anyone know what I might be doing wrong? Thanks in advance for any help! 
Roberta Arcoverde
Hi Roberta,
You need to increase the heap space used by ant since JastAdd is executed as a task within ant.
If you run ant from the command line you can use the following command: ANT_OPTS="-Xmx256M" ant. If that works you may then want to create a file ~/.ant/ant.conf containing the following string: ANT_OPTS="$ANT_OPTS -Xms256M -Xmx256M". This will give ant more memory each time it is executed.
If you run ant from within Eclipse you can increase the heap size by first selecting the build.xml file, and then Run as->Ant build ... from the context menu. Under the JRE tab you can add the following to VM arguments to prevent out-of-memory errors: -Xmx256M
There are also some detailed comments on running JastAdd from Eclipse here.
Best regards
/Torbjorn