gemini-code-assist[bot] commented on code in PR #87:
URL: https://github.com/apache/tvm-ffi/pull/87#discussion_r2403234108
##########
python/tvm_ffi/cython/tensor.pxi:
##########
@@ -343,6 +343,8 @@ cdef inline object
make_tensor_from_chandle(TVMFFIObjectHandle chandle, DLPackTo
if c_dlpack_to_pyobject != NULL:
# try convert and import into the environment array if possible
if TVMFFITensorToDLPackVersioned(chandle, &dlpack) == 0:
+ # must delete the original chandle here to avoid dangling reference
Review Comment:

This comment is slightly misleading. It mentions avoiding a "dangling
reference", but the primary issue being solved is a memory leak from an
unreleased reference count, as ownership is transferred to the DLPack tensor. A
more precise and concise comment would improve code clarity for future
maintainers.
```
# Ownership is transferred to the DLPack tensor; decref original
handle to prevent leak.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]