Closed daniel-ziegler closed 6 years ago
Putting an xt::pytensor inside an std::tuple seems to cause a memory leak, e.g.:
xt::pytensor
std::tuple
void leak() { xt::pytensor<float, 1> ones = xt::ones<float>({10}); std::tuple<xt::pytensor<float, 1>> tup(ones); }
Using pybind11's py::tuple doesn't cause the same problem.
py::tuple
Am I doing something wrong here or is this a bug?
See https://github.com/daniel-ziegler/tuple_leak/blob/master/tuple_fun.cpp for a full demonstration of the problem; you can install the package and run https://github.com/daniel-ziegler/tuple_leak/blob/master/demo.py. Intriguingly, it looks like the size of the array doesn't affect how much memory gets leaked.
I'm on pybind11 version 2.2.3 and xtensor-python version 0.19.0.
Thanks for the report! I'll look into that!
Ok, thanks for your package -- I was able to reproduce this behavior.
Putting an
xt::pytensor
inside anstd::tuple
seems to cause a memory leak, e.g.:Using pybind11's
py::tuple
doesn't cause the same problem.Am I doing something wrong here or is this a bug?
See https://github.com/daniel-ziegler/tuple_leak/blob/master/tuple_fun.cpp for a full demonstration of the problem; you can install the package and run https://github.com/daniel-ziegler/tuple_leak/blob/master/demo.py. Intriguingly, it looks like the size of the array doesn't affect how much memory gets leaked.
I'm on pybind11 version 2.2.3 and xtensor-python version 0.19.0.