Skip to content

Commit

Permalink
del model in map_function (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Aug 7, 2024
2 parents fc937a2 + 5efae61 commit e11f835
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
==================
Expand Down
3 changes: 3 additions & 0 deletions src/stpipe/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit e11f835

Please sign in to comment.