VkAllocationCallbacks(3)

# VkAllocationCallbacks(3) Manual Page

## Name

VkAllocationCallbacks - Structure containing callback function pointers for memory allocation

## C Specification

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;

## Members

- `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.

## Description

Valid Usage

- `pfnAllocation` must be a valid pointer to a valid user-defined PFN_vkAllocationFunction

- `pfnReallocation` must be a valid pointer to a valid user-defined PFN_vkReallocationFunction

- `pfnFree` must be a valid pointer to a valid user-defined PFN_vkFreeFunction

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

## See Also

PFN_vkAllocationFunction, PFN_vkFreeFunction, PFN_vkInternalAllocationNotification, PFN_vkInternalFreeNotification, PFN_vkReallocationFunction, vkAllocateMemory, vkCreateAccelerationStructureKHR, vkCreateAccelerationStructureNV, vkCreateAndroidSurfaceKHR, vkCreateBuffer, vkCreateBufferView, vkCreateCommandPool, vkCreateComputePipelines, vkCreateDebugReportCallbackEXT, vkCreateDebugUtilsMessengerEXT, vkCreateDeferredOperationKHR, vkCreateDescriptorPool, vkCreateDescriptorSetLayout, vkCreateDescriptorUpdateTemplate, vkCreateDescriptorUpdateTemplateKHR, vkCreateDevice, vkCreateDisplayModeKHR, vkCreateDisplayPlaneSurfaceKHR, vkCreateEvent, vkCreateFence, vkCreateFramebuffer, vkCreateGraphicsPipelines, vkCreateHeadlessSurfaceEXT, vkCreateIOSSurfaceMVK, vkCreateImage, vkCreateImagePipeSurfaceFUCHSIA, vkCreateImageView, vkCreateIndirectCommandsLayoutNV, vkCreateInstance, vkCreateMacOSSurfaceMVK, vkCreateMetalSurfaceEXT, vkCreatePipelineCache, vkCreatePipelineLayout, vkCreateQueryPool, vkCreateRayTracingPipelinesKHR, vkCreateRayTracingPipelinesNV, vkCreateRenderPass, vkCreateRenderPass2, vkCreateRenderPass2KHR, vkCreateSampler, vkCreateSamplerYcbcrConversion, vkCreateSamplerYcbcrConversionKHR, vkCreateSemaphore, vkCreateShaderModule, vkCreateSharedSwapchainsKHR, vkCreateStreamDescriptorSurfaceGGP, vkCreateSwapchainKHR, vkCreateValidationCacheEXT, vkCreateViSurfaceNN, vkCreateWaylandSurfaceKHR, vkCreateWin32SurfaceKHR, vkCreateXcbSurfaceKHR, vkCreateXlibSurfaceKHR, vkDestroyAccelerationStructureKHR, vkDestroyAccelerationStructureNV, vkDestroyBuffer, vkDestroyBufferView, vkDestroyCommandPool, vkDestroyDebugReportCallbackEXT, vkDestroyDebugUtilsMessengerEXT, vkDestroyDeferredOperationKHR, vkDestroyDescriptorPool, vkDestroyDescriptorSetLayout, vkDestroyDescriptorUpdateTemplate, vkDestroyDescriptorUpdateTemplateKHR, vkDestroyDevice, vkDestroyEvent, vkDestroyFence, vkDestroyFramebuffer, vkDestroyImage, vkDestroyImageView, vkDestroyIndirectCommandsLayoutNV, vkDestroyInstance, vkDestroyPipeline, vkDestroyPipelineCache, vkDestroyPipelineLayout, vkDestroyQueryPool, vkDestroyRenderPass, vkDestroySampler, vkDestroySamplerYcbcrConversion, vkDestroySamplerYcbcrConversionKHR, vkDestroySemaphore, vkDestroyShaderModule, vkDestroySurfaceKHR, vkDestroySwapchainKHR, vkDestroyValidationCacheEXT, vkFreeMemory, vkRegisterDeviceEventEXT, vkRegisterDisplayEventEXT

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.