diff options
author | 2025-03-19 14:12:09 -0700 | |
---|---|---|
committer | 2025-03-19 16:25:18 -0700 | |
commit | b790b9cb8f891bf21755ccc97a5405b2ed0687d2 (patch) | |
tree | 2f62bf7fc1ae74688bfd98113a61cc6bef87e1af /cc | |
parent | 80f92da0efc1924aa30866e64b266d1dee87aa51 (diff) |
Clear as much of cc.Module as possible after GenerateBuildActions
Reduce peak memory usage by adding a CleanupAfterBuildActions method
that is called at the end GenerateBuidlActions, nad use it to clear as
much of cc.Module as possible.
This is a temporary measure, eventually the entire module should be
released by blueprint once all interactions are performed through
providers.
Test: all soong tests pass
Change-Id: Idc3390ae4506ff2eef3231691e1de7446067961a
Diffstat (limited to 'cc')
-rw-r--r-- | cc/cc.go | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -2438,6 +2438,27 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { } } +func (c *Module) CleanupAfterBuildActions() { + // Clear as much of Module as possible to reduce memory usage. + c.generators = nil + c.compiler = nil + c.installer = nil + c.features = nil + c.coverage = nil + c.fuzzer = nil + c.sabi = nil + c.lto = nil + c.afdo = nil + c.orderfile = nil + + // TODO: these can be cleared after nativeBinaryInfoProperties and nativeLibInfoProperties are switched to + // using providers. + // c.linker = nil + // c.stl = nil + // c.sanitize = nil + // c.library = nil +} + func CreateCommonLinkableInfo(ctx android.ModuleContext, mod VersionedLinkableInterface) *LinkableInfo { info := &LinkableInfo{ StaticExecutable: mod.StaticExecutable(), |