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
BufferImpl, UndoTree, LineReaderImpl excessive memory usage #477
Comments
It seems the |
|
Clarification, my input string was not 176 MB I inputed a 88KB single line random string, on Intellij Idea's Dummy Terminal I used this https://github.com/dmadunic/clidemo project for testing, Tested on OpenJDK 13, and OracleJDK 12 |
You are using JLine 3.4, right?. From log I see that crash happens on line Buffer copy = buf.copy(); when calling |
|
When i ran it on a non Dummy Terminal.
This time compiled with Oracle JDK 1.8 |
What can easily be done is to bypass a bunch of advanced features (undo, highlighting, parsing...) when the string is longer than a configurable length (with a default to 1000 characters for example). |
Let me check it and i will get back to you soon |
It seems that fixed the issue Thanks for that, though there's some kind of an issue printing the prompt twice. |
So i've been thinking to create a public accessible cli service with Spring Shell that uses JLine 3.4 under the hood, and i was experimenting with some stuff, and then i tried to check if it can crash somehow, so i got a really huge string and provided it as input, the result was 8GB used ram, (from 176 mb) and a crash because java ran out of heap space.
I couldn't pinpoint the exact location of the issue, so i ran YourKit Java Profiler, got a memory snapshot, and i saw huge Usage on an
int[]
and on 4 classes allocating 2.4GB each, LineReaderImpl UndoTree UndoTree$Node and BufferImplIs that something that can be avoided? haven't studied the JLine's codebase. Just asking though,
The text was updated successfully, but these errors were encountered: