Skip to content
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: reduce memory usage #36943

Closed
stamblerre opened this issue Jan 31, 2020 · 18 comments
Closed

x/tools/gopls: reduce memory usage #36943

stamblerre opened this issue Jan 31, 2020 · 18 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Performance Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

stamblerre commented Jan 31, 2020

This is a general tracking issue for memory usage in gopls. We need to collect data and set goals for usage for a given project size. We also need to work towards reducing the memory usage when staticcheck is enabled (though that may be a separate issue).

If you have a specific problem with gopls using too much memory on your machine, please create a new issue so that we can investigate it separately.

Please include your editor settings and memory debug information with your issue. These are automatically written to the temporary directory (/tmp for Unixes) with names like gopls.1234-5GiB-withnames.zip. If you are uncomfortable sharing the package names of your code, you can share the -nonames zip instead.

@gopherbot gopherbot added this to the Unreleased milestone Jan 31, 2020
@gopherbot 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 Jan 31, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Jan 31, 2020
@nghialm269

This comment has been minimized.

@patrikeh

This comment has been minimized.

@guiguan

This comment has been minimized.

@myitcv

This comment has been minimized.

@stamblerre

This comment has been minimized.

@vincepri

This comment has been minimized.

@heschi

This comment has been minimized.

@trajber

This comment has been minimized.

@heschi

This comment has been minimized.

@Jacalz

This comment has been minimized.

@stamblerre

This comment has been minimized.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/236397 mentions this issue: internal/lsp/cache: intermediate test variants aren't workspace packages

gopherbot pushed a commit to golang/tools that referenced this issue Jun 11, 2020
When you write a test in (say) the fmt package, you get a test variant
augmented with the test files. In many cases you also get test variants
of the things the fmt package depends on. The primary test variant,
(fmt [fmt.test]) is interesting to us, because it contains the tests.
But the intermediate variants (testing [fmt.test]) aren't -- the user
can only get to them indirectly. We certainly don't need to fully parse
them.

Treat intermediate test variants as non-workspace packages. This doesn't
accomplish much yet but paves the way for later optimizations.

Updates golang/go#36943.

Change-Id: I1a20abcd2d67767f07132a75a20f098be6f19a76
Reviewed-on: https://go-review.googlesource.com/c/tools/+/236397
Run-TryBot: Heschi Kreinick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
@heschi
Copy link
Contributor

heschi commented Jun 11, 2020

I think the commits I pushed today have improved things significantly for large projects. I'll keep looking for a little bit.

@itzmanish

This comment has been minimized.

@stamblerre stamblerre modified the milestones: gopls/v0.7.0, gopls/v0.5.0 Jun 26, 2020
@heschi
Copy link
Contributor

heschi commented Jul 1, 2020

From the first comment:

If you have a specific problem with gopls using too much memory on your machine, please create a new issue so that we can investigate it separately.

There will be zip files in /tmp with additional memory diagnostic information. Please include one of them. If you are uncomfortable sharing the package names of your code you can pick one with a -nonames suffix, otherwise please upload a --withnames` file.

@stamblerre
Copy link
Contributor Author

There have been a number of memory improvements in gopls at master. Please try out with the instructions on https://github.com/golang/tools/blob/master/gopls/doc/user.md#unstable-versions, or wait for the next release.

@raghav-clumio
Copy link

@stamblerre just switched to master and it dropped my ram usage from 10 gigs to 1.5gb! Great work guys!

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/253577 mentions this issue: gopls/doc: add memory usage info to troubleshooting guide

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.5.0 Sep 9, 2020
@golang golang locked and limited conversation to collaborators Sep 9, 2021
@rsc rsc unassigned heschi Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Performance Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests