-
Notifications
You must be signed in to change notification settings - Fork 212
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
java.lang.OutOfMemoryError: Java heap space #441
Comments
#403 had the same error. I use Emacs myself, but have never experienced this. (even on large repos). I use Temurin/Adoptium though. I guess you are using Amazon Coretto? Are there any global settings for Java you are using? Any How much RAM does your machine have? The symbol index is currently very RAM hungry, so you should have some RAM available (I have 16GB on my Macs and it never needs that much. 8GB might be too little for very big projects). You are using an M1 Mac, yes? Are the JDK an ARM build? Or is it an x86 build running through Rosetta? |
@tapegram , that is not really important. Happens on all machines and uses. We are not using a Notebook document service, and it does not seem to cause any issues. I'm a little shocked that a machine with your amount of RAM has heap size issues. How big of a codebase are we talking? I've never had issues with any open source projects or enterprise Java/Kotlin projects in my day-job (some projects are pretty big). I guess you have already tried setting a high heap size with |
Yeah I'm not really sure what's going on with this and it makes me sad :( I just tried making the heap size like -Xmx12G with some env vars (i didnt know which to use so I used all of them lol, gradle_opts, java_opts, _java_options, sdk_java_options. And it appeared to make it not OOM, but then eventually i started getting GC specific OOM errors, so maybe I also need to learn about and then tweak GC stuff -- but it all seems weird that that is needed in the first place. Another guess is maybe because its a multi-module repo? Is that something that the current Kotlin language server can handle well? I'm also trying to upgrade the gradlew version in case that might improve performance and help with memory issues, but that's also just a guess (I assume it uses the gradlew cli behind the scenes?) I appreciate the help so far! I really want to get this working in spacemacs. I also found your blog post and video about it so that's at least giving me hope that this is possible. |
I understand that completely, wish I could do more to help 🙁
I use multi-module projects at work every day. They are a little bit slow at indexing, but I have not experienced any issues with memory (or heap space). The language server seems to handle them okay beyond that, but I think there is a limit here to how big it can handle. I have only tried Maven multi module projects, so Gradle multi module might be very different. Have only done quite small (at least compared to the Maven projects I have been working with) multi module projects in Gradle so far.
Yes, the gradlew cli is used to fetch the dependencies of the project behind the scenes. I'm currently using at least gradle 7.5 for most of my gradle projects. Use Maven for most projects though, especially the multi module ones.
Fingers crossed 🙂 Wonder if more blogs and youtube channels than mine have covered the Kotlin language server in Emacs so far. If you find any that are not mine, feel free to post them 🙂 (mine have themkat in the username or domain). I at least love seeing the language server and alternative editors for Kotlin covered in blogs and media! |
Is there a way in emacs / spacemacs to pass the jvm args directly to LSP? it feels weird to be using these big gross env vars. And are there any particular settings I should be using? This is what I have at the moment, but I still run into GC OOM errors (though its able to fully index and work for a brief moment before the GC errors start).
|
Emacs does not always pick up environment variables from your shell. One example is When I have experimented with various environment variables for an Emacs use case, I have usually just set them in elisp (e.g, using the (setenv "JAVA_OPTS" "-Xmx12g -XX:+UseParallelGC") There is no way beyond that which I'm aware of to send it directly to LSP. If you haven't tried using |
@tapegram , did you try the way of setting an environment variable directly inside of Emacs? If so, did anything improve or did you get the same results? 🙂 |
I got the same result, I was using spacemacs and fortunately/unfortunately I had already regenerated the env var file so it was getting the java options. I ended up just giving it a huge amount of memory (maybe like 18g) and it stopped getting OOM errors, however, it was just generally really slow, would get confused often, and just generally seemed to be struggling with providing the kind of language support I was hoping for. That being said, I'm still eagerly following this project! I'll probably be retrying it every now and again in the hope of escaping intellij! Thanks for all your help and for working on the language server! |
I tried to debug further.. It might be connected to protobuf communication with the kotlin compiler daemon. I added a log where we can see |
I finally got around to investigating this a bit further. Found some information online about the Unsure if this helps us further in this issue, but writing it in case someone smarter than me can get use for it 🙂 |
I'm also experiencing this issue. I have a ~100k loc codebase and after 9minutes 42 seconds of indexing (12801 symbols) with CPU constantly at 80-100%, the LSP crashes with an out-of-memory error. I'm using the LSP with helix and hardware is M2 Pro Mac with 32GB of RAM, if that helps. Unfortunately this makes the LSP practically unusable which is very unfortunate since the only alternative editor that I can use (or at least I'm aware of) is IntelliJ. I see that there have been many similar or possibly related issues over the years:
Has there been any updates on this area lately? I can help to debug this and provide additional information if needed 😇 Here's the stacktrace
|
Hello! I've been trying to get the LSP server working for me in vscode and spacemacs on and off for a bit, but I consistently run into the same OOM error when trying to work in a medium/large-ish repo
I've been following different guides and trying random things like
and was just wondering if there is any actual solution to this?
Some other information:
Any help is appreciated, thanks!
The text was updated successfully, but these errors were encountered: