summaryrefslogtreecommitdiff
path: root/android/module.go
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 /android/module.go
parent8b391cba7fbe102dce869f71c97f0954bf61d4b5 (diff)
parentb790b9cb8f891bf21755ccc97a5405b2ed0687d2 (diff)
Merge "Clear as much of cc.Module as possible after GenerateBuildActions" into main
Diffstat (limited to 'android/module.go')
-rw-r--r--android/module.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/android/module.go b/android/module.go
index ecd0f239c..c0abfd0a3 100644
--- a/android/module.go
+++ b/android/module.go
@@ -45,6 +45,14 @@ type Module interface {
// For more information, see Module.GenerateBuildActions within Blueprint's module_ctx.go
GenerateAndroidBuildActions(ModuleContext)
+ // CleanupAfterBuildActions is called after ModuleBase.GenerateBuildActions is finished.
+ // If all interactions with this module are handled via providers instead of direct access
+ // to the module then it can free memory attached to the module.
+ // This is a temporary measure to reduce memory usage, eventually blueprint's reference
+ // to the Module should be dropped after GenerateAndroidBuildActions once all accesses
+ // can be done through providers.
+ CleanupAfterBuildActions()
+
// Add dependencies to the components of a module, i.e. modules that are created
// by the module and which are considered to be part of the creating module.
//
@@ -2387,8 +2395,12 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
})
}
}
+
+ m.module.CleanupAfterBuildActions()
}
+func (m *ModuleBase) CleanupAfterBuildActions() {}
+
func SetJarJarPrefixHandler(handler func(ModuleContext)) {
if jarJarPrefixHandler != nil {
panic("jarJarPrefixHandler already set")