MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Free

Method Free

Source/ThirdParty/VulkanMemoryAllocator/vk_mem_alloc.h:4784–4806  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4782
4783template<typename T>
4784void VmaPoolAllocator<T>::Free(T* ptr)
4785{
4786 // Search all memory blocks to find ptr.
4787 for (size_t i = m_ItemBlocks.size(); i--; )
4788 {
4789 ItemBlock& block = m_ItemBlocks[i];
4790
4791 // Casting to union.
4792 Item* pItemPtr;
4793 memcpy(&pItemPtr, &ptr, sizeof(pItemPtr));
4794
4795 // Check if pItemPtr is in address range of this block.
4796 if ((pItemPtr >= block.pItems) && (pItemPtr < block.pItems + block.Capacity))
4797 {
4798 ptr->~T(); // Explicit destructor call.
4799 const uint32_t index = static_cast<uint32_t>(pItemPtr - block.pItems);
4800 pItemPtr->NextFreeIndex = block.FirstFreeIndex;
4801 block.FirstFreeIndex = index;
4802 return;
4803 }
4804 }
4805 VMA_ASSERT(0 && "Pointer doesn't belong to this memory pool.");
4806}
4807
4808template<typename T>
4809typename VmaPoolAllocator<T>::ItemBlock& VmaPoolAllocator<T>::CreateNewBlock()

Callers 13

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
~MemoryPoolAllocatorMethod · 0.45

Calls 15

memcpyFunction · 0.85
VmaBinaryFindSortedFunction · 0.85
IsVirtualFunction · 0.85
vma_deleteFunction · 0.85
backMethod · 0.80
GetHeapBudgetsMethod · 0.80
IsPersistentMapMethod · 0.80
GetAllocHandleMethod · 0.80

Tested by

no test coverage detected