class cupy.cuda.CFunctionAllocator(intptr_t param, intptr_t malloc_func, intptr_t free_func, owner)[source]#

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.

  • param (int) – Address of param.

  • malloc_func (int) – Address of malloc.

  • free_func (int) – Address of free.

  • owner (object) – Reference to the owner object to keep the param and the functions alive.


malloc(self, size_t size) MemoryPointer#
__eq__(value, /)#

Return self==value.

__ne__(value, /)#

Return self!=value.

__lt__(value, /)#

Return self<value.

__le__(value, /)#

Return self<=value.

__gt__(value, /)#

Return self>value.

__ge__(value, /)#

Return self>=value.