I am trying to create ParseTree objects for a huge set of (really huge) java files using the Java7 grammar, but in the middle, getting an out of memory issue with GC overhead. I am cleaning up the ParseTree and Parser/Lexer after completing each file. When I looked at the memory analyzer, it is found that org.antlr.v4.runtime.dfa.DFA[] is taking 87% of the heap space. I have gone through some old bugs related to this but nothing really works for me. I am using Antlr version 4.7.
From the old bugs, I understand that clearing the DFA[] won't help. Are there any APIs being added for the cache eviction and to release resources efficiently? thanks in advance.