diff --git a/src/pb_stub.cc b/src/pb_stub.cc index a26719d2..51df5aa2 100644 --- a/src/pb_stub.cc +++ b/src/pb_stub.cc @@ -1032,9 +1032,9 @@ Stub::~Stub() { py::gil_scoped_acquire acquire; - async_event_loop_ = py::none(); - background_futures_ = py::none(); - model_instance_ = py::none(); + py::object async_event_loop_local(std::move(async_event_loop_)); + py::object background_futures_local(std::move(background_futures_)); + py::object model_instance_local(std::move(model_instance_)); } stub_instance_.reset(); stub_message_queue_.reset(); diff --git a/src/pb_tensor.cc b/src/pb_tensor.cc index 1ab95144..9fde62fe 100644 --- a/src/pb_tensor.cc +++ b/src/pb_tensor.cc @@ -503,6 +503,14 @@ PbTensor::~PbTensor() noexcept(false) { pb_memory_.reset(); DeleteDLPack(); + +#ifdef TRITON_PB_STUB + { + py::gil_scoped_acquire acquire; + py::array numpy_array_local(std::move(numpy_array_)); + py::array numpy_array_serialized_local(std::move(numpy_array_serialized_)); + } +#endif } const std::string&