summaryrefslogtreecommitdiff
path: root/cc
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2025-03-21 14:37:59 -0700
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-03-21 14:37:59 -0700
commit07638f131eafac3cf915cbeb5d1003037347c41d (patch)
tree664036fa2d5620262b3260c1b78fcdcc95a1b993 /cc
parent8b391cba7fbe102dce869f71c97f0954bf61d4b5 (diff)
parentb790b9cb8f891bf21755ccc97a5405b2ed0687d2 (diff)
Merge "Clear as much of cc.Module as possible after GenerateBuildActions" into main
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/cc/cc.go b/cc/cc.go
index 85d2ebfbb..c616165c5 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -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(),