Skip to content

cmd/link: linker memory use increase from 1.10 to 1.11 #26186

Closed
@thanm

Description

@thanm

What version of Go are you using (go version)?

tip:
go version devel +1e1bd239c5 Thu Jun 28 16:10:19 2018 -0400 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"

What did you do?

When I build large Go programs, I note that memory consumption has increased during the link step, when moving from Go 1.10 to Go 1.11; it seems that the linker is taking more memory than it used to. The memory consumption increase varies from program to program, but looks on the order of 20-30%. Building "hyperkube" from kubernetes tip (1.11) is one example. The 20% number is is derived from building a specific copy of "hyperkube" with 1.10 & 1.11 and comparing heap profiles collected via

go build -ldflags "-memprofile XXX -memprofilerate 1"

using "go tool pprof". Link steps that use the external linker (for CGO) have larger increases.

The current theory is that this is related to additional DWARF symbols/sections/relocations that the compiler is emitting (for example, DWARF location lists are now enabled with 1.11, as are DWARF inline info records).

It would be worth doing some work to figure out exactly where the memory increase is coming from, and submitting fixes to bring down the overall usage if possible, so as to avoid having the linker run out of memory when linking very large Go programs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions