title: java.lang.OutOfMemoryError: Java heap space on org.eclipse.jdt.core.dom.CompilationUnit
body: <p>When I process one java file or a few, I have not problems, but if the number of java it is around 90 i get "<code>java.lang.OutOfMemoryError: Java heap space</code>". I have as Default VM Arguments in eclipse: </p>
  
  <pre><code>java.lang.OutOfMemoryError: -Xms1024M -Xmx3072M.
  </code></pre>
  
  <p>This code is executed for each java file. The exception it is throws on the second last line.</p>
  
  <pre><code>ASTParser parser = ASTParser.newParser(AST.JLS3);
              parser.setResolveBindings(false);
              parser.setKind(ASTParser.K_COMPILATION_UNIT);
              final String text = buffer.toString();
              parser.setSource(text.toCharArray());
              final CompilationUnit node = (CompilationUnit) parser.createAST(null);
  
  
              node.accept( new ASTVisitor() {
  
                  @Override
                  public boolean visit(MethodDeclaration node) {
  
                      methodDeclaration.put( node.getName().toString(), node);
                      return super.visit(node);
                  }
              });
  
              TypeDeclaration types = (TypeDeclaration)node.types().get(0);
              List&lt;BodyDeclaration&gt; body = types.bodyDeclarations();
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>java.lang.OutOfMemoryError: Java heap space
      at org.eclipse.jdt.internal.compiler.parser.Parser.newMessageSend(Parser.java:9191)
      at org.eclipse.jdt.internal.compiler.parser.Parser.consumeMethodInvocationName(Parser.java:4630)
      at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:5922)
      at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9368)
      at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9704)
      at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.parseStatements(MethodDeclaration.java:119)
      at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.parseMethods(TypeDeclaration.java:831)
      at org.eclipse.jdt.core.dom.CompilationUnitResolver.parse(CompilationUnitResolver.java:539)
      at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1194)
      at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:801)
      at parser.infocaja.WindowParser.process(WindowParser.java:211)
      at parser.infocaja.WindowParser.main(WindowParser.java:117)
  </code></pre>