-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
2x more memory than gometalinter #509
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
I've noticed that disabling megacheck reduces memory consumption to ~8GB. But as far as I remember it produces lots of useful warnings and it's enabled in gometalinter. |
I've also noticed that golangci-lint somewhat unexpectedly ignores my GOMAXPROCS=1 setting. I expected that would reduce concurrency to 1, but it didn't. Now I see -j flag for this. Perhaps it would be more reasonable to not mess with GOMAXPROCS if -j is not specified. But it does not seem to help with the original problem. GOGC=50 -j=1 still crashed on my laptop after consuming 14GB. GOGC=20 -j=1 already consumed 13+GB and I had to abort it after 6 minutes of runtime (much slower than gometalinter). |
Hi, |
I can imagine there may be some differences due to somewhat different versions, but was there a change in staticcheck that adds 8 gigs and doubles overall memory consumption? I would assume there is something else in play here. |
We are observing the same. Within our CI env with only govet, golint,gofmt, and typecheck we are noticing golangci-lint is much slower then gometalinter when only running with 4GB of memory. |
staticcheck takes more memory, but even vet takes 10G:
|
Wait, I noticed that golangci-lint does not actually seem to skip the dirs specified in skip-dirs. I have some huge autogenerated files there, and a bunch of such packages are listed in skip-dirs. But if I delete some of the largest files, memory consumption of checking time drops dramatically:
|
I ran into this issue now as well. When I tried to upgrade to 1.16 our CircleCI lint job started to get killed due to OOM (I think they might have a 4G limit). Our project does not yet use go modules. I use this config: run:
skip-dirs:
- dir1
- node_modules
- dir2
linters:
enable:
- govet
# - goimports
# - gofmt
# - typecheck
- staticcheck
- gosimple
disable-all: true
linters-settings:
goimports:
local-prefixes: ourdomain.com
issues:
exclude:
- composite literal uses unkeyed fields Using 1.16 on macOS:
Using 1.15:
Using 1.12.5:
Using 1.10:
I realise that this might be an apple to oranges comparison, but I've seen with other tools that when go module support was introduced, the memory usage increased a lot. I also tested with a bunch of different packages:
In almost all cases memory usage increased going from 1.15 to 1.16. |
I also have this issue and it actually crashes Docker on my machine. |
I saw an OOM as well. gqlgen creates huge auto-generated files and we have a few of those. That might be part of the problem. These files account for 217k lines of code in our repo across 6 files. I hope they are not being processed unnecessarily. It's OOMing for us sometimes on a 16 GB RAM machine. |
Adding
to the config file and |
Wait, I put |
So we now finally switched to golangci-lint! Woohoo! From my perspective it can now be rebranded to updating docs so that people searching for "autogenerated" or "memory consumption" could find the answer. |
@dvyukov Could you share the right location for build-tags in the config file? 😄 |
@daxmc99 you will find it here: |
Hi!
|
go version go1.12.1 linux/amd64
golangci-lint is on 39f46be (current HEAD)
I am verifying github.com/google/syzkaller on 51fc038380062aec71b4e39af9227c6db0be4fd8.
Currently we use gomatalinter on Travis and it usually passes (with GOGC=50 fits into 10GB).
Running
CGO_ENABLED=1 GOMAXPROCS=1 GOGC=50 gometalinter.v2 ./...
locally consumes 8-9GB.But running
golangci-lint run ./...
crashes with OOM on my laptop that has 14GB of free RAM. I can make it pass locally with GOGC=20 (most of time in GC, but still faster than gometalinter), it consumes all 14GB.But I can't make it work on Travis. Even with GOGC=20 it still OOM killed:
https://travis-ci.org/google/syzkaller/jobs/523524512
https://travis-ci.org/google/syzkaller/jobs/523524511
I don't know how actionable this is. But maybe there is some kind of leak? Or some way to run linters sequentially and GC in-between? Or some other way to trade time for space?
The text was updated successfully, but these errors were encountered: