<divclass="textblock"><p>This library contains several functions that return information about its internal state, especially the amount of memory allocated from Vulkan.</p>
<p>If you need to obtain basic statistics about memory usage per heap, together with current budget, you can call function <aclass="el"href="group__group__stats.html#ga9f88db9d46a432c0ad7278cecbc5eaa7"title="Retrieves information about current memory usage and budget for all memory heaps.">vmaGetHeapBudgets()</a> and inspect structure <aclass="el"href="struct_vma_budget.html"title="Statistics of current memory usage and available budget for a specific memory heap.">VmaBudget</a>. This is useful to keep track of memory usage and stay within budget (see also <aclass="el"href="staying_within_budget.html">Staying within budget</a>). Example:</p>
<divclass="ttc"id="agroup__group__stats_html_ga9f88db9d46a432c0ad7278cecbc5eaa7"><divclass="ttname"><ahref="group__group__stats.html#ga9f88db9d46a432c0ad7278cecbc5eaa7">vmaGetHeapBudgets</a></div><divclass="ttdeci">void vmaGetHeapBudgets(VmaAllocator allocator, VmaBudget *pBudgets)</div><divclass="ttdoc">Retrieves information about current memory usage and budget for all memory heaps.</div></div>
</div><!-- fragment --><p>You can query for more detailed statistics per memory heap, type, and totals, including minimum and maximum allocation size and unused range size, by calling function <aclass="el"href="group__group__stats.html#ga36f3484de7aa6cd6edc4de9edfa0ff59"title="Retrieves statistics from current state of the Allocator.">vmaCalculateStatistics()</a> and inspecting structure <aclass="el"href="struct_vma_total_statistics.html"title="General statistics from current state of the Allocator - total memory usage across all memory heaps a...">VmaTotalStatistics</a>. This function is slower though, as it has to traverse all the internal data structures, so it should be used only for debugging purposes.</p>
<p>You can query for statistics of a custom pool using function <aclass="el"href="group__group__stats.html#ga34d8e7d83774eed0caee5c5ae88e217d"title="Retrieves statistics of existing VmaPool object.">vmaGetPoolStatistics()</a> or <aclass="el"href="group__group__stats.html#ga50ba0eb25d2b363b792be4645ca7a380"title="Retrieves detailed statistics of existing VmaPool object.">vmaCalculatePoolStatistics()</a>.</p>
<p>You can query for information about a specific allocation using function <aclass="el"href="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b"title="Returns current information about specified allocation.">vmaGetAllocationInfo()</a>. It fill structure <aclass="el"href="struct_vma_allocation_info.html"title="Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().">VmaAllocationInfo</a>.</p>
<p>You can dump internal state of the allocator to a string in JSON format using function vmaBuildStatsString(). The result is guaranteed to be correct JSON. It uses ANSI encoding. Any strings provided by user (see <aclass="el"href="allocation_annotation.html#allocation_names">Allocation names</a>) are copied as-is and properly escaped for JSON, so if they use UTF-8, ISO-8859-2 or any other encoding, this JSON string can be treated as using this encoding. It must be freed using function vmaFreeStatsString().</p>
<p>The format of this JSON string is not part of official documentation of the library, but it will not change in backward-incompatible way without increasing library major version number and appropriate mention in changelog.</p>
<p>The JSON string contains all the data that can be obtained using <aclass="el"href="group__group__stats.html#ga36f3484de7aa6cd6edc4de9edfa0ff59"title="Retrieves statistics from current state of the Allocator.">vmaCalculateStatistics()</a>. It can also contain detailed map of allocated memory blocks and their regions - free and occupied by allocations. This allows e.g. to visualize the memory or assess fragmentation. </p>