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

reduce 1.5x memory usage on large repos on repeated runs #764

Merged
merged 1 commit into from
Oct 1, 2019

Conversation

jirfag
Copy link
Member

@jirfag jirfag commented Sep 30, 2019

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
@tpounds tpounds added the topic: memory Huge memory consumption label Sep 30, 2019
Copy link
Member

@ernado ernado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

BTW still getting OOM'ed on kubernetes codebase :(

Showing nodes accounting for 4195.99MB, 72.50% of 5787.34MB total
Dropped 328 nodes (cum <= 28.94MB)
Showing top 10 nodes out of 150
      flat  flat%   sum%        cum   cum%
 2838.82MB 49.05% 49.05%  2911.32MB 50.31%  honnef.co/go/tools/ssa.memberFromObject
  260.05MB  4.49% 53.55%   958.12MB 16.56%  honnef.co/go/tools/ssa.makeWrapper
  254.66MB  4.40% 57.95%   275.16MB  4.75%  go/types.methodSet.add
  156.67MB  2.71% 60.65%   485.84MB  8.39%  go/types.NewMethodSet
  134.01MB  2.32% 62.97%   134.01MB  2.32%  go/types.(*Selection).Type
  119.79MB  2.07% 65.04%   119.79MB  2.07%  golang.org/x/tools/go/types/typeutil.Hasher.Hash
  118.60MB  2.05% 67.09%   118.60MB  2.05%  go/types.(*Checker).recordTypeAndValue
  109.15MB  1.89% 68.97%  1071.27MB 18.51%  honnef.co/go/tools/ssa.(*Program).addMethod
  105.71MB  1.83% 70.80%   105.71MB  1.83%  bytes.makeSlice
   98.52MB  1.70% 72.50%    98.52MB  1.70%  honnef.co/go/tools/ssa.(*Function).newBasicBlock

inuse:

 1582.61MB 51.06% 51.06%  1634.11MB 52.72%  honnef.co/go/tools/ssa.memberFromObject
  199.08MB  6.42% 57.48%   199.08MB  6.42%  bytes.makeSlice
   87.07MB  2.81% 60.29%    87.07MB  2.81%  go/types.(*Checker).recordTypeAndValue
   80.52MB  2.60% 62.89%   306.54MB  9.89%  honnef.co/go/tools/ssa.makeWrapper
   63.03MB  2.03% 64.92%    69.03MB  2.23%  go/types.methodSet.add
   53.50MB  1.73% 66.65%    53.50MB  1.73%  honnef.co/go/tools/ssa.NewConst
   49.60MB  1.60% 68.25%    49.60MB  1.60%  golang.org/x/tools/go/types/typeutil.Hasher.Hash
   44.50MB  1.44% 69.68%    44.50MB  1.44%  go/types.NewParam
   42.72MB  1.38% 71.06%    42.72MB  1.38%  go/scanner.(*Scanner).scanString
   40.03MB  1.29% 72.35%   122.06MB  3.94%  go/types.NewMethodSet

pprof.golangci-lint.alloc_objects.alloc_space.inuse_objects.inuse_space.004.pb.gz

@jirfag
Copy link
Member Author

jirfag commented Oct 1, 2019

@ernado did you try disabling unused?

@jirfag jirfag merged commit df4f676 into master Oct 1, 2019
@jirfag jirfag deleted the feature/reduce-memory-usage-more branch October 1, 2019 11:52
@ernado
Copy link
Member

ernado commented Oct 1, 2019

@jirfag I've tried right now, and it is much better:

172.86user 3.05system 0:28.17elapsed 624%CPU (0avgtext+0avgdata 1581020maxresident)k
226720inputs+42408outputs (5major+594733minor)pagefaults 0swaps

So just 1.5Gb RSS, very cool.

@jirfag
Copy link
Member Author

jirfag commented Oct 1, 2019

It's good. We need to add information about unused and GOMAXPROCS into README into the memory section. I will look at it at the weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: memory Huge memory consumption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants