Skip to content

Consume too much memory: Memory: 173 samples, avg is 4131.5MB, max is 8547.9MB #628

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

Closed
yangwenmai opened this issue Aug 1, 2019 · 4 comments
Labels
duplicate This issue or pull request already exists topic: memory Huge memory consumption

Comments

@yangwenmai
Copy link

Version

golangci-lint has version v1.17.1 built from (unknown, mod sum: "h1:lc8Hf9GPCjIr0hg3S/xhvFT1+Hydass8F1xchr8jkME=") on (unknown)

Config

linters-settings:
  goconst:
    min-len: 2
    min-occurrences: 2
  lll:
    line-length: 140
  misspell:
    # Correct spellings using locale preferences for US or UK.
    # Default is to use a neutral variety of English.
    # Setting locale to US will correct the British spelling of 'colour' to 'color'.
    locale: US
    ignore-words:
      - someword

linters:
  disable:
    - gosimple
    - staticcheck
    - errcheck
    - ineffassign
  enable:
    - deadcode
    - structcheck
    - unconvert
    - megacheck
    - goconst
    - lll
    - unused
    - govet
    - misspell

run:
  skip-dirs:
    - vendor
  skip-files:
    - .*.pb.go
    - .*.xo.go

go version && go env

go version go1.12.7 darwin/amd64
GOARCH="amd64"
GOBIN="/Users/maiyang/goworkspace/bin"
GOCACHE="/Users/maiyang/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/maiyang/goworkspace"
GOPROXY=""
GORACE=""
GOROOT="/Users/maiyang/go1.12.7"
GOTMPDIR=""
GOTOOLDIR="/Users/maiyang/go1.12.7/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hy/qzqhs53939lg6b93mr419lnh0000gn/T/go-build349347446=/tmp/go-build -gno-record-gcc-switches -fno-common"

golangci-lint run -v

INFO [config_reader] Config search paths: [./xxx ]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 10 linters: [deadcode goconst govet lll misspell structcheck typecheck unconvert unused varcheck]
INFO [loader] Go packages loading at mode load types and syntax took 8.081403646s
INFO [loader] SSA repr building timing: packages building 118.079288ms, total 1.149810418s
INFO [runner] worker.8 took 5.017180349s with stages: goconst: 5.017168399s
INFO [runner] worker.4 took 6.106411697s with stages: structcheck: 6.106402699s
INFO [runner] worker.3 took 7.70048065s with stages: deadcode: 7.700470723s
INFO [runner] worker.6 took 8.513320461s with stages: varcheck: 6.425121963s, unconvert: 2.088168812s
INFO [runner] worker.1 took 8.629177762s with stages: govet: 8.629169995s
INFO [runner] worker.5 took 10.727311529s with stages: lll: 10.727284064s, typecheck: 18.171µs
INFO [runner] worker.7 took 10.796104583s with stages: misspell: 10.796094542s
INFO [runner] worker.2 took 18.003705406s with stages: unused: 18.003685152s
INFO [runner] Workers idle times: #1: 9.392345225s, #3: 9.90426717s, #4: 11.449243361s, #5: 7.276350363s, #6: 9.469505369s, #7: 7.207636831s, #8: 12.520719802s
INFO [runner] Issues before processing: 2028, after processing: 0
INFO [runner] processing took 31.610486ms with stages: skip_files: 13.089487ms, path_prettifier: 8.02513ms, cgo: 3.78815ms, filename_unadjuster: 2.077532ms, skip_dirs: 1.588013ms, exclude: 971.629µs, autogenerated_exclude: 940.607µs, nolint: 835.39µs, identifier_marker: 276.691µs, exclude-rules: 4.568µs, diff: 2.472µs, max_same_issues: 2.102µs, path_shortener: 1.947µs, source_code: 1.945µs, max_from_linter: 1.795µs, uniq_by_line: 1.562µs, max_per_file_from_linter: 1.466µs
INFO File cache stats: 1085 entries of total size 12.0MiB
INFO Memory: 173 samples, avg is 4131.5MB, max is 8547.9MB
INFO Execution took 27.568865593s
jirfag added a commit that referenced this issue Sep 23, 2019
Set analysis pass results to nil early to garbage collect them
soon.
Memory can be reduced for the following linters:
  - staticcheck
  - stylecheck
  - gosimple
  - govet
  - bodyclose
  - any future go/analysis linter

Relates: #712, #634, #628, #598, #509, #483, #337
jirfag added a commit that referenced this issue Sep 23, 2019
Set analysis pass results to nil early to garbage collect them
soon.
Memory can be reduced for the following linters:
  - staticcheck
  - stylecheck
  - gosimple
  - govet
  - bodyclose
  - any future go/analysis linter

Relates: #712, #634, #628, #598, #509, #483, #337
@jirfag
Copy link
Contributor

jirfag commented Sep 23, 2019

Hi!
I've significantly reduced memory usage of staticcheck, gosimple, stylecheck, govet and bodyclose.
Please, try the latest version from the master branch.

@yangwenmai
Copy link
Author

OK, Thanks for your work.

@yangwenmai
Copy link
Author

yangwenmai commented Sep 24, 2019

INFO [lintersdb] Active 10 linters: [deadcode goconst govet lll misspell structcheck typecheck unconvert unused varcheck]
...
INFO Memory: 306 samples, avg is 419.1MB, max is 6648.8MB
INFO Execution took 41.958423693s

@tpounds tpounds added duplicate This issue or pull request already exists topic: memory Huge memory consumption labels Sep 25, 2019
@tpounds
Copy link
Contributor

tpounds commented Sep 25, 2019

Closing as duplicate of #337.

@tpounds tpounds closed this as completed Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists topic: memory Huge memory consumption
Projects
None yet
Development

No branches or pull requests

3 participants