MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator / FreeMemory

Method FreeMemory

include/vk_mem_alloc.h:14685–14728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14683}
14684
14685void VmaAllocator_T::FreeMemory(
14686 size_t allocationCount,
14687 const VmaAllocation* pAllocations)
14688{
14689 VMA_ASSERT(pAllocations);
14690
14691 for(size_t allocIndex = allocationCount; allocIndex--; )
14692 {
14693 VmaAllocation allocation = pAllocations[allocIndex];
14694
14695 if(allocation != VK_NULL_HANDLE)
14696 {
14697#if VMA_DEBUG_INITIALIZE_ALLOCATIONS
14698 FillAllocation(allocation, VMA_ALLOCATION_FILL_PATTERN_DESTROYED);
14699#endif
14700
14701 switch(allocation->GetType())
14702 {
14703 case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
14704 {
14705 VmaBlockVector* pBlockVector = VMA_NULL;
14706 VmaPool hPool = allocation->GetParentPool();
14707 if(hPool != VK_NULL_HANDLE)
14708 {
14709 pBlockVector = &hPool->m_BlockVector;
14710 }
14711 else
14712 {
14713 const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex();
14714 pBlockVector = m_pBlockVectors[memTypeIndex];
14715 VMA_ASSERT(pBlockVector && "Trying to free memory of unsupported type!");
14716 }
14717 pBlockVector->Free(allocation);
14718 }
14719 break;
14720 case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
14721 FreeDedicatedMemory(allocation);
14722 break;
14723 default:
14724 VMA_ASSERT(0);
14725 }
14726 }
14727 }
14728}
14729
14730void VmaAllocator_T::CalculateStatistics(VmaTotalStatistics* pStats)
14731{

Callers 2

vmaDestroyBufferFunction · 0.80
vmaDestroyImageFunction · 0.80

Calls 4

GetTypeMethod · 0.80
GetParentPoolMethod · 0.45
GetMemoryTypeIndexMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected