Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Parsing Java files with JDT and it's memory consumption / performance
Parsing Java files with JDT and it's memory consumption / performance [message #1744269] Fri, 23 September 2016 19:09
Markus Oley is currently offline Markus OleyFriend
Messages: 304
Registered: July 2009
Location: Germany
Senior Member
Hi to all,

I want to parse java code with jdt from commandline and so I wrote a small tool, which parses the java files in the following kind:

ASTParser parser = ASTParser.newParser(AST.JLS8);
parser.setEnvironment(classpath, srcPaths, encodings, false);

parser.setSource(//String of file read before);

parser.setResolveBindings(true);
parser.setBindingsRecovery(true);
parser.setUnitName(name of File);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
CompilationUnit cu = (CompilationUnit) parser.createAST(null);


With this code I get an OOM with 2GB after reading 1300 java files, but I can resolve e.g. MethodInvocations. If i skip the

parser.setBindinsRecovery(true)
the tool finishes, but the whole bindings are not resolved.

My small and perhaps easy question: How can I implement this with less memory consumption and better performance AND getting all things resolved? I guess jdt implementaion in eclipse itself needs maximum some MBs to read the AST.

Thanks for your help
Markus
Previous Topic:Parsing Java files with JDT and it's memory consumption / performance
Next Topic:Parsing Java files with JDT and it's memory consumption / performance
Goto Forum:
  


Current Time: Thu Mar 28 13:29:58 GMT 2024

Powered by FUDForum. Page generated in 0.02832 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top