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

Method Free

include/vk_mem_alloc.h:5148–5170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5146
5147template<typename T>
5148void VmaPoolAllocator<T>::Free(T* ptr)
5149{
5150 // Search all memory blocks to find ptr.
5151 for (size_t i = m_ItemBlocks.size(); i--; )
5152 {
5153 ItemBlock& block = m_ItemBlocks[i];
5154
5155 // Casting to union.
5156 Item* pItemPtr = VMA_NULL;
5157 memcpy(&pItemPtr, &ptr, sizeof(pItemPtr));
5158
5159 // Check if pItemPtr is in address range of this block.
5160 if ((pItemPtr >= block.pItems) && (pItemPtr < block.pItems + block.Capacity))
5161 {
5162 ptr->~T(); // Explicit destructor call.
5163 const uint32_t index = static_cast<uint32_t>(pItemPtr - block.pItems);
5164 pItemPtr->NextFreeIndex = block.FirstFreeIndex;
5165 block.FirstFreeIndex = index;
5166 return;
5167 }
5168 }
5169 VMA_ASSERT(0 && "Pointer doesn't belong to this memory pool.");
5170}
5171
5172template<typename T>
5173typename VmaPoolAllocator<T>::ItemBlock& VmaPoolAllocator<T>::CreateNewBlock()

Callers 11

PopFrontMethod · 0.45
PopBackMethod · 0.45
ClearMethod · 0.45
RemoveMethod · 0.45
MergeBlockMethod · 0.45
FreeMethod · 0.45
DefragmentPassEndMethod · 0.45
FreeMemoryMethod · 0.45
FreeDedicatedMemoryMethod · 0.45
vmaVirtualFreeFunction · 0.45

Calls 15

VmaBinaryFindSortedFunction · 0.85
vma_deleteFunction · 0.85
IsFreeMethod · 0.80
FreePagesMethod · 0.80
GetHeapBudgetsMethod · 0.80
GetOffsetMethod · 0.80
IsPersistentMapMethod · 0.80
UnmapMethod · 0.80

Tested by

no test coverage detected