CFunctionAllocator(intptr_t param, intptr_t malloc_func, intptr_t free_func, owner)¶
Allocator with C function pointers to allocation routines.
This allocator keeps raw pointers to a param object along with functions pointers to malloc and free, delegating the actual allocation to external sources while only handling the timing of the resource allocation and deallocation.
malloc should follow the signature
void*(*malloc)(void*, size_t, int)returning the pointer to the allocated memory given the pointer to param, the number of bytes to allocate and the device id on which the allocation should take place.
Similarly, free should follow the signature
void(*free)(void*, void*, int)with no return, taking the pointer to param, the pointer to the allocated memory and the device id on which the memory was allocated.