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

poolset: Add optional destructor function #76

Merged
merged 1 commit into from
Jan 10, 2024
Merged

Conversation

jpsamaroo
Copy link
Collaborator

MemPool's usage of distributed refcounting and GC finalizers causes slightly excessive memory retention, because it takes sometimes some extra time or an extra GC cycle to clean up data that's been poolset once all DRefs are freed.

This PR adds an optional user-defined "destructor" callback, which is invoked when an object that's been poolset becomes no longer referenced by any DRef (which can allow eagerly cleaning up associated memory, rather than letting the GC figure it out on its own). This will be used by Dagger to allow cleaning up cached Dagger task results once all user references are deleted, and the scheduler determines that it no longer needs to use that data. This can cause memory usage to be better controlled when Dagger (and MemPool) are tracking large amounts of data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant