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

Comments

@stamblerre
Copy link
Contributor

@stamblerre 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.

@nghialm269

This comment has been hidden.

@patrikeh

This comment has been hidden.

@guiguan

This comment has been hidden.

@myitcv

This comment has been hidden.

@stamblerre

This comment has been hidden.

@vincepri

This comment has been hidden.

@heschi

This comment has been hidden.

@trajber

This comment has been hidden.

@heschi

This comment has been hidden.

@Jacalz

This comment has been hidden.

@stamblerre

This comment has been hidden.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 4, 2020

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 <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@heschi
Copy link
Contributor

@heschi 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 hidden.

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

@heschi 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

@stamblerre stamblerre commented Aug 12, 2020

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

@raghav-clumio raghav-clumio commented Aug 17, 2020

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

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 8, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet