You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In short, close() doesn't actually free everything from memory until garbage collection, certain attributes of the model are still accessible after close(), and the FileReference object that is tracked by open() and close() would be unnecessary if we just made open() call hdulist.close() after the whole model was loaded into the datamodel (ObjectNode) structure.
Therefore, if we also use lazy_load=False with asdf we could entirely remove FileReference and DataModel.close which would simplify the DataModel and ModelContainer api (by no longer needing to close or keep track of closing files). If a particular use-case wished to release the datamodel from memory before garbage collection, simply del model would be the recommended way to do so, just like with every other Python object.
This change would effectively close the door on the potential to lazy-load datamodels through the datamodels.open() interface. However, lazy loading from fits is currently not supported, and supporting it would be more difficult than providing an API for loading headers, which is already proposed in https://jira.stsci.edu/browse/JP-3882
The text was updated successfully, but these errors were encountered:
Issue JP-3883 was created on JIRA by Ned Molter:
There are several long-standing issues with datamodel.close(); see
spacetelescope/stdatamodels#29
spacetelescope/stdatamodels#300
spacetelescope/stdatamodels#311
In short, close() doesn't actually free everything from memory until garbage collection, certain attributes of the model are still accessible after close(), and the FileReference object that is tracked by open() and close() would be unnecessary if we just made open() call hdulist.close() after the whole model was loaded into the datamodel (ObjectNode) structure.
Therefore, if we also use
lazy_load=False
withasdf
we could entirely removeFileReference
andDataModel.close
which would simplify theDataModel
andModelContainer
api (by no longer needing to close or keep track of closing files). If a particular use-case wished to release the datamodel from memory before garbage collection, simplydel model
would be the recommended way to do so, just like with every other Python object.This change would effectively close the door on the potential to lazy-load datamodels through the datamodels.open() interface. However, lazy loading from fits is currently not supported, and supporting it would be more difficult than providing an API for loading headers, which is already proposed in https://jira.stsci.edu/browse/JP-3882
The text was updated successfully, but these errors were encountered: