diff --git a/CHANGES.rst b/CHANGES.rst index a4d63238..cd457810 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ - remove Windows tests and add info box indicating lack of Windows support to README [#163] - add ``ModelLibrary`` container class [#156] - add ``ModelLibrary`` docs [#168] +- improve memory usage of ``ModelLibrary.map_function`` [#181] 0.6.1 (unreleased) ================== diff --git a/src/stpipe/library.py b/src/stpipe/library.py index b0e83be9..4011a44a 100644 --- a/src/stpipe/library.py +++ b/src/stpipe/library.py @@ -743,6 +743,9 @@ def map_function(self, function, modify=True): # this is in a finally to allow cleanup if the generator is # deleted after it finishes (when it's not fully consumed) self.shelve(model, index, modify) + # remove the local reference to model here to allow it + # to be garbage collected before the next model is generated + del model def _model_to_filename(self, model): """