summaryrefslogtreecommitdiff
path: root/buildstream/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/element.py')
-rw-r--r--buildstream/element.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index a3bf59dc6..5ecc25ab2 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -966,6 +966,21 @@ class Element(Plugin):
return element
+ # _clear_meta_elements_cache()
+ #
+ # Clear the internal meta elements cache.
+ #
+ # When loading elements from meta, we cache already instantiated elements
+ # in order to not have to load the same elements twice.
+ # This clears the cache.
+ #
+ # It should be called whenever we are done loading all elements in order
+ # to save memory.
+ #
+ @classmethod
+ def _clear_meta_elements_cache(cls):
+ cls.__instantiated_elements = {}
+
# _get_redundant_source_refs()
#
# Fetches a list of (Source, ref) tuples of all the Sources