Structures

VkAllocationCallbacks

Structure containing callback function pointers for memory allocation

Allocators are provided by the application as a pointer to a VkAllocationCallbacks structure:

typedef struct VkAllocationCallbacks {
    void* pUserData;
    PFN_vkAllocationFunction pfnAllocation;
    PFN_vkReallocationFunction pfnReallocation;
    PFN_vkFreeFunction pfnFree;
    PFN_vkInternalAllocationNotification pfnInternalAllocation;
    PFN_vkInternalFreeNotification pfnInternalFree;
} VkAllocationCallbacks;
  • pUserData is a value to be interpreted by the implementation of the callbacks. When any of the callbacks in VkAllocationCallbacks are called, the Vulkan implementation will pass this value as the first parameter to the callback. This value can vary each time an allocator is passed into a command, even when the same object takes an allocator in multiple commands.
  • pfnAllocation is a PFN_vkAllocationFunction pointer to an application-defined memory allocation function.
  • pfnReallocation is a PFN_vkReallocationFunction pointer to an application-defined memory reallocation function.
  • pfnFree is a PFN_vkFreeFunction pointer to an application-defined memory free function.
  • pfnInternalAllocation is a PFN_vkInternalAllocationNotification pointer to an application-defined function that is called by the implementation when the implementation makes internal allocations.
  • pfnInternalFree is a PFN_vkInternalFreeNotification pointer to an application-defined function that is called by the implementation when the implementation frees internal allocations.

Valid Usage

VUID-VkAllocationCallbacks-pfnAllocation-00632

pfnAllocation must be a valid pointer to a valid application-defined PFN_vkAllocationFunction

VUID-VkAllocationCallbacks-pfnReallocation-00633

pfnReallocation must be a valid pointer to a valid application-defined PFN_vkReallocationFunction

VUID-VkAllocationCallbacks-pfnFree-00634

pfnFree must be a valid pointer to a valid application-defined PFN_vkFreeFunction

VUID-VkAllocationCallbacks-pfnInternalAllocation-00635

If either of pfnInternalAllocation or pfnInternalFree is not NULL, both must be valid callbacks