Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

del model in map_function #181

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading