From 99d6fcb985dc13a52e9a335a5693ae33433ce3ca Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Mon, 25 Jul 2022 11:18:01 +0200 Subject: [PATCH] Fixed incorrect counting of m_BlocksFreeSize when merging margin blocks. Code by @medranSolus --- include/vk_mem_alloc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 4f1c238..cc8fa24 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -10587,9 +10587,10 @@ void VmaBlockMetadata_TLSF::Free(VmaAllocHandle allocHandle) VkDeviceSize debugMargin = GetDebugMargin(); if (debugMargin > 0) { + VMA_ASSERT(next->size == debugMargin); // Adjust stats for one less block --m_BlocksFreeCount; - m_BlocksFreeSize -= block->size; + m_BlocksFreeSize -= debugMargin; MergeBlock(next, block); block = next; next = next->nextPhysical;