commit | 8ef45cf60b347abb1a08416fca1b6d19d317b26e | [log] [tgz] |
---|---|---|
author | Cherry Zhang <cherryyz@google.com> | Tue Apr 23 11:34:58 2019 -0400 |
committer | Cherry Zhang <cherryyz@google.com> | Fri Apr 26 20:50:31 2019 +0000 |
tree | ec8e55e26c634c4d1d1b0742da28730ad60ee3bc | |
parent | 1805f425ada8184b53175fd166b5fec7c02850a4 [diff] |
cmd/link: reduce the size of Reloc struct For linking large binaries, the slice of Relocs consumes a large amount of memory. We can reduce this memory consumption by shrinking the size of the Reloc struct. This CL moves the fields used only in external linking or only on PPC64 and S390X to a lazily initialized side struct. Linking k8s.io/kubernetes/cmd/kube-apiserver on Linux/AMD64, before: inuse_space 1240.25MB total 438.11MB 35.32% 35.32% 438.11MB 35.32% cmd/link/internal/objfile.(*objReader).readSlices after: inuse_space 1123.39MB total 306.85MB 27.31% 55.03% 306.85MB 27.31% cmd/link/internal/objfile.(*objReader).readSlices Under GOGC=5 (to simulate system under memory pressure), the max RSS reduces from ~2.05G to ~1.83G. Even with external linking the max RSS doesn't increase. Change-Id: I9bb8a8effaed24a8b3c4b1cfb93e6992b8740f91 Reviewed-on: https://go-review.googlesource.com/c/go/+/173437 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.