-
Notifications
You must be signed in to change notification settings - Fork 165
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
Add GC support to graph objects #258
Add GC support to graph objects #258
Conversation
Right now the 2 graph classes in retworkx, PyGraph and PyDiGraph, did not integrate with the Python garbage collector. This would result in memory not being cleared in a running python process even if retworkx objects were only created in temporary context. This commit attempts to fix this by implementing the garbage collection protocol [1] which should enable python to clean up retworkx objects when they're no longer being used. [1] https://pyo3.rs/v0.12.4/class/protocols.html?highlight=garbage#garbage-collector-integration
I'm marking this on hold because I want to do some performance benchmarks on this before we merge it. But this will be a release blocker because it's causing a memory leak in qiskit-terra. |
Pull Request Test Coverage Report for Build 614503023
💛 - Coveralls |
Removing the on hold because I think there really isn't any performance impact here at least from the retworkx side. I ran the transpile benchmark in https://github.com/mtreinish/retworkx-bench and there was no real difference in performance. |
LGTM as a fix for |
Yep, I did it for the custom return types separately in #260 because I had been wanting |
Co-authored-by: Kevin Krsulich <[email protected]>
It looks like there is an infrastructure issue with travis CI on ppc64le nodes (the logs just stop without error) I'm going to merge this |
Right now the 2 graph classes in retworkx, PyGraph and PyDiGraph, did
not integrate with the Python garbage collector. This would result in
memory not being cleared in a running python process even if retworkx
objects were only created in temporary context. This commit attempts to
fix this by implementing the garbage collection protocol [1] which
should enable python to clean up retworkx objects when they're no longer
being used.
[1] https://pyo3.rs/v0.12.4/class/protocols.html?highlight=garbage#garbage-collector-integration