-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: high memory consumption #47855
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
Comments
In general FWIW, glancing at the attached zip, |
@heschi I've added a new archive. Please take a look at it. |
No. I don't see any signs of a memory leak. If you want, you can try setting https://github.com/golang/tools/blob/master/gopls/doc/settings.md#memorymode-enum. Use it at your own risk. |
So this is normal behavior? |
I'd say the high memory usage is expected currently - Goland and gopls take different approaches. Gopls dev team is currently working on improvement in this area. The |
I thought all source needs to be in /src directory - it means hundreds of imports and all my projects! Happy if someone can explains how to remove this "virus" from VS Code. |
How to enable "DegradeClosed" memory mode in vim?
|
The next release of gopls (expected in March) will include major reductions in memory usage, so if you're on the verge of giving up, consider holding on just a few more weeks. |
@n-r-w which version of gopls are you using? We're still smoothing out some edge cases and so have not yet cut a prerelease for [email protected], but I expect memory usage to be significantly reduced once we do. |
v0.11.0 |
It's great to hear that. Because right now my gopls is using 34 Gb of memory :) |
Hi all, we just cut the first prerelease version of gopls to include the new architecture:
More details in the release notes. This is a prerelease version: there are several known regressions that we're still working on. However, it should use significantly less memory. I'd love to hear from users currently struggling with gopls' memory usage, whether this release improves their experience. If it doesn't, there may be more we can do given additional details. Thanks! |
Early impressions are very positive for me: Working with the Gitea codebase in VSCode, after letting things settle, my |
Thanks for the feedback, @garymoon!
FWIW this is likely due to a background GC cycle, and/or the timing of background work that gopls is doing. To get a more detailed picture of memory usage, you can start gopls with |
Hi folks, We just released the second prerelease, which fixes several bugs reported since
At this point, gopls' memory footprint has fundamentally changed: gopls requires very little data in memory other than file content. To reduce its steady-state memory further would require dropping file content, and we don't current plan to do that (doing so would introduce a lot of complexity). There may be additional issues related to memory: for example, gopls could use less memory during large operations such as rename. However, those would be specific problems that deserve a separate github issue. Therefore, I am going to close this issue as fixed. Thanks everyone for your feedback and patience. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes. I have the latest versions of gopls and go.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Opened cockroachDB repository in vim(same thing with neovim) with vim-go plugin and gopls enabled.
I've removed everything but vim-go and gopls from the .vimrc and disabled all other plugins. But the result is the same.
What did you expect to see?
Normal memory consumption. For example, Jetbrains Goland uses ~2GB when this project is open
What did you see instead?
gopls consumes about 9GB of memory, sometimes more than 14GB.
gopls.30806-8GiB-withnames.zip
gopls.3081-14GiB-withnames.zip
The text was updated successfully, but these errors were encountered: