Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/gopls: high memory consumption when used with a monorepo #37670
Please answer these questions before submitting your issue. Thanks!
What did you do?
Our code is in a fairly large monorepo containing about 26K files, including vendored packages.
What did you expect to see?
gopls using 1-2GB of memory. That's a wild guess that I can't really validate, but 8-10 seems excessive.
What did you see instead?
The gopls process is using 8-10GB of memory. This number goes up and down with editor usage, but it never goes below about 6GB, and it generally hovers around 8GB. This is a 16GB laptop, so there's quite a bit of memory pressure when gopls is running.
Nearly all the code in our monorepo is intended for linux, and this is a mac, so I've experimented with adding this setting:
This does affect the number of errors reported by gopls, but the memory consumption is approximately unchanged.
Unfortunately I don't have good news for you. Everything you've posted points to expected behavior -- I don't see any signs of a memory leak or work pileup. It looks like the monorepo is simply too large to work with all at once.
If you're only interested in one folder, you can start VS Code in that folder. If you're interested in multiple, you can add them piecemeal to your workspace, but note that most