-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/tools/gopls: high memory use and sluggishness #45363
Comments
I'm working with @bhcleek on this privately. |
Change https://golang.org/cl/310170 mentions this issue: |
We still hear from users for whom gopls uses too much memory. My efforts to reduce memory usage while maintaining functionality are proving fruitless, so perhaps it's time to accept some functionality loss. DegradeClosed MemoryMode typechecks all packages in ParseExported mode unless they have a file open. This should dramatically reduce memory usage in monorepo-style scenarious, where a ton of packages are in the workspace and the user might plausibly want to edit any of them. (Otherwise they should consider using directory filters.) The cost is that features that work across multiple packages...won't. Find references, for example, will only find uses in open packages or in the exported declarations of closed packages. The current implementation is a bit leaky; we keep the ParseFull packages in memory even once all their files are closed. This is related to a general failure on our part to drop unused packages from the snapshot, so I'm not going to try to fix it here. Updates golang/go#45457, golang/go#45363. Change-Id: I38b2aeeff81a1118024aed16a3b75e18f17893e2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/310170 Trust: Heschi Kreinick <heschi@google.com> Run-TryBot: Heschi Kreinick <heschi@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
We just cut a prerelease of gopls including a significantly different model for package information:
I believe this should significantly improve memory usage. Please let me know if it doesn't. In the meantime, this issue seems mostly redundant with https://go.dev/issue/47855, which while filed later has gained more traction. I will close this in favor of #47855, where we can track verifying that memory usage has improved. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Start up gopls in our monorepo in module aware mode by opening vscode or Vim w/ vim-go
What did you expect to see?
Similar memory use and performance as when using GOPATH mode.
What did you see instead?
Very high memory use and sluggishness. Using module aware mode, gopls very quickly starts using 10GB of memory or more. Other users internally report even higher memory use.
Performance is generally very sluggish. Completion requests, for example, have a noticable delay before a response is delivered.
In GOPATH mode, memory sits around 300MB and gopls is very responsive.
The text was updated successfully, but these errors were encountered: