--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Jim,Firstly thanks for your reply. I am not using any database in my application. It should be database independent.
Before calling walker on a particular file i need to analyze all the input files.
So i thought analyzing through parser is the best one. So i am building the parse tree in the first step itself and then i am using the same tree for walker in the later part without building the parse tree again to reduce the tree building time. Is there any other better approach for my situation.
It seems like you have two options:
1. Provide more memory. Don’t be shy; I like to run my tests in the JVM with -Xmx12g.
2. Reduce memory needed. There is more than one way to do this:
a. If the memory is used by the parse trees: instead of storing the parse trees directly, store them using a weak reference (or soft reference) and reparse them if the GC collected them. Note that you might not be able to use ParseTreeProperty<T> with this approach, since it links properties directly to a specific object.
b. If the memory is used by the DFA cache: update your grammar rule that need long lookahead to require less lookahead. Another option is to use my fork of the runtime, which is highly tuned for minimizing the memory required to store the DFA. (For parsing with the reference Java grammar, the memory used in the DFA cache by my fork is less than 10% of the memory needed by the reference release of ANTLR 4. Results vary by grammar.)
Sam