The text was updated successfully, but these errors were encountered:
gopherbot
added
Tools
This label describes issues relating to any tools in the x/tools repository.
gopls
Issues related to the Go language server, gopls.
labels
Aug 4, 2022
That gopls uses a lot of memory is a known (and difficult) problem. See for example #47855.
However, 5gb is a lot, and we should check whether that makes sense based on your usage. Can you tell me:
Approximately how many .go files are in your workspace (this depends on which folder was resolved as your workspace folder).
Do you experience this memory usage immediately, or does it take a while to build up? There was a large memory leak that will be fixed in the next gopls release (v0.9.2), so I'm curious if you may be experiencing that.
Unfortunately, at the moment 5gb is not unheard-of memory usage when working on large projects, such as Kubernetes. We're working on this, but it is a long-term project.
findleyr
added
the
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
label
Aug 5, 2022
Unfortunately, I don't have a great way to answer the first question. The number is hard to know because of the libraries being referenced, but the project itself has 3500 Go files, though not all referenced in all parts of the code. One thing I can say is that we have a single file generated by gqlgen that has 256k lines in it and is probably a big culprit.
Initially loading the project causes the machine to spin for a good five minutes or so and it'll spike to 3-4 GB pretty easily. It'll settle around 2-3 after a while but spikes as the files are edited. Multiple files could be changed at the same time with multiple vim windows going on. I do have the gopls server running for quite a long time though.
I expect you'll see it stay in the the ~3gb range after gopls@v0.9.2 is released. I'll take a look at the heap dump you've provided to see if I can understand this better.
codisms commentedAug 4, 2022
gopls version
go env
What did you do?
Editing Go files with vim and vim-go.
What did you expect to see?
Lower memory consumption.
What did you see instead?
Over 5GB of memory consumption; thrashing swap file.
Editor and settings
Logs
gopls.3782930-5GiB-nonames.zip
The text was updated successfully, but these errors were encountered: