-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Lower or control memory usage #337
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
Comments
Related to #342 and pointers usage on latest commit. We could dig more, sure, but it's a start. |
Hi! |
mem.pdf |
We have regular intermittent build failures due to high memory usage. It would be good to reduce usage. Currently: we're using...
See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint |
The crossplane jenkins worker node only has 10gb of RAM. With 1.17.1 of golangci-lint we regularly see 10gb consumed while linting in local environments. The changes suggested here appear to improve the overhead. golangci/golangci-lint#337 (comment) Prior to the bump to 1.17.1, golangci-lint was taking 6-8GB of RAM and completing in 10s. With the reduction in overhead to golangci-lint that this PR introduces, linting consumes between 8-9GB of ram and completes in 30s using the same environment. The intent here is to continue using latest golangci-lint with the current Jenkins configuration, sacrificing some time. Additional measure can be made, such as using `--fast` tests only or further increasing the LINT_GOGC value. https://github.com/golangci/golangci-lint#configuration https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint Signed-off-by: Marques Johansson <[email protected]>
istio/istio repo uses 32gb to lint: |
👍 |
I've merged a fix reducing memory usage of go/analysis linters (staticcheck, gosimple, stylecheck, bodyclose, govet) 5x. Please, check it in a master branch. |
😍
staticcheck seems to have slowed down, but it caught new errors, so maybe it was upgraded on master. |
It's still using 29 GB of memory when running with all linters enabled rather than enabling 1 linter at a time. Is that expected? Is it just a side effect of Go's GC and it wouldn't use that much memory if it wasn't available? |
@gracenoah thank you for comparison, |
It's not, sorry. It's an internal monorepo. If you want me to test some proposed performance changes, you can email me at [email protected] but that's all I can do. |
I've investigated more high memory consumption.
|
Hi @jirfag 👋 We continually have memory issues with https://github.com/terraform-providers/terraform-provider-aws if you're looking for an open source project to test. v1.19.1 still throws TravisCI out of memory errors for us with |
Hi @jirfag - continuing the conversation here from #731! A few hours ago, you wrote:
But that is not the reality we are facing; in fact, we are experiencing the opposite (a huge increase in memory consumption that starts exactly at the commit claimed to improve things), as I demonstrated in #731. Unfortunately, our codebase is not open-source, but I am happy to run experiments for you and report results back, as |
One additional note for folks struggling with this. For us, a large portion of memory consumption was coming from concurrent use of go's linker. We were previously able to reduce this significantly by setting |
@bmhatfield I guess it was caused by large update of |
Run all linters per package. It allows unloading package data when it's processed. It dramatically reduces memory (and CPU because of GC) usage. Relates: #337
Get rid of AST cache: load AST when needed. Optimize memory allocations for go/analysis actions. Relates: #337
|
Get rid of AST cache: load AST when needed. Optimize memory allocations for go/analysis actions. Relates: #337
Do you plan to release another tag ? |
The latest version of golangci-lint is running slower and runs out of memory. See golangci/golangci-lint#337 for ongoing work on improving it. Triple the deadline to allow more time, and only run a single thread for testing to avoid running out of memory. Also make the garbage collector more aggressive to avoid holding onto excess memory. Signed-off-by: Michael Smith <[email protected]>
❤️you so much @jirfag |
https://github.com/golangci/golangci-lint/releases/tag/v1.20.0 includes all memory optimizations |
@y0ssar1an thank you :) |
…, add exclude-rules for unexpected SA1019 issues, replace deprecated deadline with timeout Reference: #10236 Reference: golangci/golangci-lint#337 (comment)
See golangci-lint memory improvement described at golangci/golangci-lint#337 which may help with problem on travis CI server when testing previous commit i.e. golangci-lint run --timeout 30m fatal error: runtime: out of memory
Even with |
Users complain about too much memory usage exceeding 8gb
The text was updated successfully, but these errors were encountered: