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

DM-31507 Modify data-structures to aid ref counting #568

Merged
merged 1 commit into from Aug 26, 2021

Conversation

natelust
Copy link
Contributor

It is desirable that variables get cleaned up when they go out of
scope, meaning that their ref count must go to zero. Some objects
kept closures or circular references which means they must be
cleaned by the garbage collector which can happen at unpredictable
times. Make these objects able to be dropped with reference counting.

Copy link
Contributor

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK, one comment may be worth to think about.

Comment on lines 143 to 147
def _config(self) -> Optional[Config]:
return self._config_()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My general worry about this pattern is that previously _config was never None, while after this change it is possible (may be improbable) that weakref returns None if original Config is gone. Could you make it return Config instead of Optional[Config] and raise an exception if weakref object is deleted? This applies to other packages where you use the same method, I'm not going to comment on it there.

It is desirable that variables get cleaned up when they go out of
scope, meaning that their ref count must go to zero. Some objects
kept closures or circular references which means they must be
cleaned by the garbage collector which can happen at unpredictable
times. Make these objects able to be dropped with reference counting.
@natelust natelust merged commit b83a959 into master Aug 26, 2021
@natelust natelust deleted the tickets/DM-31507 branch August 26, 2021 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants