You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thank you so much for pyo3 and for the great documentation.
I think I encountered a memory leak with PyBytes::new which I'm using extensively to pass numpy and pandas dataframes from Rust to Python (and vice-versa).
🌍 Environment
Your operating system and version: Linux 5.4.23 (NixOS)
Your python version: 3.7.6
How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?: I use a virtualenv
Your rust version (rustc --version): rustc 1.43.0-nightly (75cf41afb 2020-03-04)
Are you using the latest pyo3 version? Have you tried using latest master (replace version = "0.x.y" with git = "https://github.com/PyO3/pyo3")?. I'm using 0.9.0.alpha-1.
💥 Reproducing
I generated a 1MB file with dd if=/dev/zero of=1MB count=1024 bs=1024. Then cargo run the following main.rs:
The RAM usage should increase by 4G when this program runs. I'm not sure when the memory should be deallocated: is it when the PyBytes is dropped? Or should the Python runtime garbage-collect it, since it's not being used?
Here is a diagram of the memory usage, generated with gperftools (I zipped it because github doesn't support svg files)
Thank you for the nice perf, @little-dude !
As David says, it's intended behavior now and you need to release GILGuard to decrease reference counts of objects.
Hi,
First, thank you so much for
pyo3
and for the great documentation.I think I encountered a memory leak with
PyBytes::new
which I'm using extensively to pass numpy and pandas dataframes from Rust to Python (and vice-versa).🌍 Environment
rustc --version
):rustc 1.43.0-nightly (75cf41afb 2020-03-04)
version = "0.x.y"
withgit = "https://github.com/PyO3/pyo3")?
. I'm using0.9.0.alpha-1
.💥 Reproducing
I generated a 1MB file with
dd if=/dev/zero of=1MB count=1024 bs=1024
. Thencargo run
the followingmain.rs
:The RAM usage should increase by 4G when this program runs. I'm not sure when the memory should be deallocated: is it when the
PyBytes
is dropped? Or should the Python runtime garbage-collect it, since it's not being used?Here is a diagram of the memory usage, generated with
gperftools
(I zipped it because github doesn't support svg files)heap.zip
The text was updated successfully, but these errors were encountered: