Struct TVMFFIObjectAllocHeader#
Defined in File c_api.h
Struct Documentation#
-
struct TVMFFIObjectAllocHeader#
Mandatory header placed immediately before each TVMFFIObject body.
A
TVMFFIObject::deletermay invoke this header’sdelete_spacecallback when the object’s storage lifetime ends. Frontend custom allocators can use this mechanism to coordinate cleanup of language-specific state, such as a cached PyObject wrapper, with reclamation of the TVM FFI allocation.The callback may be NULL if the object deleter releases the storage directly.
Public Members
-
void (*delete_space)(void *ptr)#
Reclaim storage allocated for a TVMFFIObject.
When used,
TVMFFIObject::deleterinvokes this callback after the object’s weak lifetime ends. The callback is responsible for eventually reclaiming the complete allocator-owned allocation, including any private prefix, and cleaning up associated frontend state.Note
ptrpoints to the object body, not to the precedingTVMFFIObjectAllocHeader. The object’s C++ lifetime may already have ended, so the callback must not access its fields.Note
This callback may be NULL if the object deleter reclaims the allocation directly.
- Param ptr:
Pointer to the object body returned by the allocator.
-
void (*delete_space)(void *ptr)#