<p>You can annotate allocations with your own information, e.g. for debugging purposes. To do that, fill <aclass="el"href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19"title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> field when creating an allocation. It is an opaque <code>void*</code> pointer. You can use it e.g. as a pointer, some handle, index, key, ordinal number or any other value that would associate the allocation with your custom metadata. It is useful to identify appropriate data structures in your engine given <aclass="el"href="struct_vma_allocation.html"title="Represents single memory allocation.">VmaAllocation</a>, e.g. when doing <aclass="el"href="defragmentation.html">Defragmentation</a>.</p>
<divclass="ttc"id="astruct_vma_allocation_create_info_html"><divclass="ttname"><ahref="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><divclass="ttdoc">Parameters of new VmaAllocation.</div><divclass="ttdef"><b>Definition</b> vk_mem_alloc.h:1246</div></div>
<divclass="ttc"id="astruct_vma_allocation_create_info_html_a8259e85c272683434f4abb4ddddffe19"><divclass="ttname"><ahref="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">VmaAllocationCreateInfo::pUserData</a></div><divclass="ttdeci">void * pUserData</div><divclass="ttdoc">Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...</div><divclass="ttdef"><b>Definition</b> vk_mem_alloc.h:1285</div></div>
<divclass="ttc"id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><divclass="ttname"><ahref="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><divclass="ttdeci">VmaMemoryUsage usage</div><divclass="ttdoc">Intended usage of memory.</div><divclass="ttdef"><b>Definition</b> vk_mem_alloc.h:1254</div></div>
<divclass="ttc"id="astruct_vma_allocation_html"><divclass="ttname"><ahref="struct_vma_allocation.html">VmaAllocation</a></div><divclass="ttdoc">Represents single memory allocation.</div></div>
</div><!-- fragment --><p>The pointer may be later retrieved as <aclass="el"href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13"title="Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...">VmaAllocationInfo::pUserData</a>:</p>
<divclass="ttc"id="agroup__group__alloc_html_ga86dd08aba8633bfa4ad0df2e76481d8b"><divclass="ttname"><ahref="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a></div><divclass="ttdeci">void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)</div><divclass="ttdoc">Returns current information about specified allocation.</div></div>
<divclass="ttc"id="astruct_vma_allocation_info_html_adc507656149c04de7ed95d0042ba2a13"><divclass="ttname"><ahref="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">VmaAllocationInfo::pUserData</a></div><divclass="ttdeci">void * pUserData</div><divclass="ttdoc">Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...</div><divclass="ttdef"><b>Definition</b> vk_mem_alloc.h:1412</div></div>
</div><!-- fragment --><p>It can also be changed using function <aclass="el"href="group__group__alloc.html#gaf9147d31ffc11d62fc187bde283ed14f"title="Sets pUserData in given allocation to new value.">vmaSetAllocationUserData()</a>.</p>
<p>Values of (non-zero) allocations' <code>pUserData</code> are printed in JSON report created by <aclass="el"href="group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0"title="Builds and returns statistics as a null-terminated string in JSON format.">vmaBuildStatsString()</a> in hexadecimal form.</p>
<p>An allocation can also carry a null-terminated string, giving a name to the allocation. To set it, call <aclass="el"href="group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc"title="Sets pName in given allocation to new value.">vmaSetAllocationName()</a>. The library creates internal copy of the string, so the pointer you pass doesn't need to be valid for whole lifetime of the allocation. You can free it after the call.</p>
<divclass="ttc"id="agroup__group__alloc_html_gabe02cbb0cd913b3f125958179f2020fc"><divclass="ttname"><ahref="group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc">vmaSetAllocationName</a></div><divclass="ttdeci">void vmaSetAllocationName(VmaAllocator allocator, VmaAllocation allocation, const char *pName)</div><divclass="ttdoc">Sets pName in given allocation to new value.</div></div>
</div><!-- fragment --><p>The string can be later retrieved by inspecting <aclass="el"href="struct_vma_allocation_info.html#a28612f3e897e5b268254a3c63413d759"title="Custom allocation name that was set with vmaSetAllocationName().">VmaAllocationInfo::pName</a>. It is also printed in JSON report created by <aclass="el"href="group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0"title="Builds and returns statistics as a null-terminated string in JSON format.">vmaBuildStatsString()</a>.</p>
<dlclass="section note"><dt>Note</dt><dd>Setting string name to VMA allocation doesn't automatically set it to the Vulkan buffer or image created with it. You must do it manually using an extension like VK_EXT_debug_utils, which is independent of this library. </dd></dl>