mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/link: free loader memory after LoadFull
After LoadFull, we'll be using sym.Symbols mostly. We still need the loader information for symbol index mappings and name lookups, but not much else. Free some memory. Linking cmd/compile, name old time/op new time/op delta Loadlibfull_GC 44.5M ± 0% 35.8M ± 0% -19.66% (p=0.008 n=5+5) Archive_GC 46.4M ± 0% 37.6M ± 0% -18.89% (p=0.008 n=5+5) Linking cmd/compile with external linking, name old time/op new time/op delta Loadlibfull_GC 82.5M ± 0% 57.4M ± 0% -30.41% (p=0.008 n=5+5) Archive_GC 86.8M ± 0% 61.7M ± 0% -28.90% (p=0.008 n=5+5) Change-Id: I6859d488172ef8968918b86de527fbfed6832ebf Reviewed-on: https://go-review.googlesource.com/c/go/+/230300 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
df2a46f85a
commit
f886ff7b41
2 changed files with 33 additions and 1 deletions
|
|
@ -2124,6 +2124,38 @@ func (l *Loader) LoadFull(arch *sys.Arch, syms *sym.Symbols, needReloc bool) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Free some memory.
|
||||
// At this point we still need basic index mapping, and some fields of
|
||||
// external symbol payloads, but not much else.
|
||||
l.values = nil
|
||||
l.symSects = nil
|
||||
l.outdata = nil
|
||||
l.itablink = nil
|
||||
l.attrOnList = nil
|
||||
l.attrLocal = nil
|
||||
l.attrNotInSymbolTable = nil
|
||||
l.attrVisibilityHidden = nil
|
||||
l.attrDuplicateOK = nil
|
||||
l.attrShared = nil
|
||||
l.attrExternal = nil
|
||||
l.attrReadOnly = nil
|
||||
l.attrTopFrame = nil
|
||||
l.attrSpecial = nil
|
||||
l.attrCgoExportDynamic = nil
|
||||
l.attrCgoExportStatic = nil
|
||||
l.outer = nil
|
||||
l.align = nil
|
||||
l.dynimplib = nil
|
||||
l.dynimpvers = nil
|
||||
l.localentry = nil
|
||||
l.extname = nil
|
||||
l.elfType = nil
|
||||
l.plt = nil
|
||||
l.got = nil
|
||||
l.dynid = nil
|
||||
l.relocVariant = nil
|
||||
l.extRelocs = nil
|
||||
}
|
||||
|
||||
// ResolveABIAlias given a symbol returns the ABI alias target of that
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue