Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Antlr 4.7 creating Java Heap Size Out Of Memory issue #2384

Open
sufail opened this issue Oct 22, 2018 · 3 comments
Open

Antlr 4.7 creating Java Heap Size Out Of Memory issue #2384

sufail opened this issue Oct 22, 2018 · 3 comments

Comments

@sufail
Copy link

sufail commented Oct 22, 2018

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. Is there any APIs being added for the cache eviction and to release resources efficiently?

@sufail sufail changed the title Antlr 4.7 creating Java Heap Size Out Of Memory issue i Antlr 4.7 creating Java Heap Size Out Of Memory issue Oct 22, 2018
@ericvergnaud
Copy link
Contributor

ericvergnaud commented Oct 22, 2018 via email

@Mestarxh
Copy link

Mestarxh commented Aug 10, 2021

This is what happened to me !!!I find the memory of org.antlr.v4.runtime.dfa.DFA do not gc。
here is my code:

val lexer = new myparserLexer(new ANTLRInputStream(clean_text));
lexer.removeErrorListeners();
lexer.addErrorListener(new ThrowingErrorListener());
val tokens = new CommonTokenStream(lexer);
val parser = new myparserParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(new ThrowingErrorListener());
val tree = parser.exprs();
val vistor = new parseVistor(is_sequence, is_graph);
vistor.visit(tree);

after run this code

val tree = parser.exprs()

the memory do not gc, even I manual gc。

how can I do?thank you

@ericvergnaud
Copy link
Contributor

ericvergnaud commented Aug 13, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants