nicegraf
ngf_allocation_callbacks Struct Reference

Data Fields

void *(* allocate )(size_t obj_size, size_t nobjs, void *userdata)
 
void(* free )(void *ptr, size_t obj_size, size_t nobjs, void *userdata)
 
void * userdata
 

Detailed Description

Specifies host memory allocation callbacks for the library's internal needs.

Field Documentation

◆ allocate

void *(* ngf_allocation_callbacks::allocate) (size_t obj_size, size_t nobjs, void *userdata)

This callback shall allocate a region of memory that is able to fit nobjs objects of size obj_size, and return a pointer to the allocated region. The starting address of the allocated region shall have the largest alignment for the target platform.

◆ free

void(* ngf_allocation_callbacks::free) (void *ptr, size_t obj_size, size_t nobjs, void *userdata)

This callback shall free a region allocated by the custom allocator. The count and size of objects in the region are supplied as additional parameters.

◆ userdata

void* ngf_allocation_callbacks::userdata

An arbitrary pointer that will be passed as-is to the allocate and free callbacks.