summaryrefslogtreecommitdiff
path: root/android/module.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2025-03-21 15:04:59 -0700
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-03-21 15:04:59 -0700
commit5355996a3c0932db4bb1f6e527ca2f8407901b88 (patch)
tree8ca21cbd041025660aeb12abaed378009ee5c209 /android/module.go
parent002547bd12142d09ddaccc4eaa9294e9ae4ef9c8 (diff)
parent07638f131eafac3cf915cbeb5d1003037347c41d (diff)
Merge "Clear as much of cc.Module as possible after GenerateBuildActions" into main am: 07638f131e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3552206 Change-Id: I29e063fdacdf56344c925177cfdf5f4c95fe6c2a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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")