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

Use weak references to automate object cleanup #19

Open
shwina opened this issue Oct 15, 2019 · 1 comment
Open

Use weak references to automate object cleanup #19

shwina opened this issue Oct 15, 2019 · 1 comment
Assignees

Comments

@shwina
Copy link
Owner

shwina commented Oct 15, 2019

Currently, all pyamgx objects must be explicitly cleaned up by calling a .destroy() method, but it should be possible to automatically clean up objects when they go out of scope (or at exit), using weakref.finalize - Python >= 3.4 only.

@shwina shwina self-assigned this Oct 15, 2019
@shwina
Copy link
Owner Author

shwina commented Jul 30, 2020

Work on this has been started at https://github.com/shwina/pyamgx/tree/0.2dev. We don't really need to use weakref.finalize -- Cython's __dealloc__ works fine to automate cleanup. We just need to be careful to keep references to upstream objects: for example, each Vector should keep a reference to the Resources object it depends on.

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

No branches or pull requests

1 participant