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

Force removal of Pyo3 Object to avoid memory leak #168

Merged
merged 4 commits into from
Jan 14, 2023

Conversation

haixuanTao
Copy link
Collaborator

This PR fix the memory leak happening in the dora API operator. This is seemingly due to pyo3 leaking memory on object created in Rust. Using standard drop did not drop the memory on the PyBytes included in the PyDict.

See: PyO3/pyo3#1801

Fixes #163

This commit fix the memory leak happening in the dora API operator. This
is seemingly due to pyo3 leaking memory on object created in Rust.
Using standard `drop` did not drop the memory on the `PyBytes` included in
the `PyDict`.

See: PyO3/pyo3#1801

Fixes #163
To alievate the unbounded memory growth, we're replacing variable dereferencing
with scoped `GILPool` as described in the pyo3 documentation recently updated. See:
PyO3/pyo3#2864
Copy link
Collaborator

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

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

Looks good!

binaries/runtime/src/operator/python.rs Show resolved Hide resolved
binaries/runtime/src/operator/python.rs Outdated Show resolved Hide resolved
binaries/runtime/src/operator/python.rs Outdated Show resolved Hide resolved
@haixuanTao haixuanTao merged commit a841577 into main Jan 14, 2023
@haixuanTao haixuanTao deleted the fix-memory-leak-pyo3 branch January 14, 2023 14:11
@haixuanTao haixuanTao mentioned this pull request Jan 18, 2023
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.

Memory leaks with Python API Operator
2 participants