Skip to content

Commit

Permalink
fix dlpack memory leak (InternLM#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
ispobock authored Mar 26, 2024
1 parent 893a574 commit 9c954ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/turbomind/python/bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ PYBIND11_MODULE(_turbomind, m)
"__dlpack__",
[](triton::Tensor* self, long stream) {
auto tensor_ptr = TritonTensorToDLManagedTensor(*self);
return new py::capsule(tensor_ptr.release(), kDlTensorCapsuleName, [](PyObject* obj) {
return py::capsule(tensor_ptr.release(), kDlTensorCapsuleName, [](PyObject* obj) {
DLManagedTensor* dlmt =
static_cast<DLManagedTensor*>(PyCapsule_GetPointer(obj, kDlTensorCapsuleName));
if (dlmt) {
Expand Down

0 comments on commit 9c954ef

Please sign in to comment.