Fixed incorrect counting of m_BlocksFreeSize when merging margin blocks.
Code by @medranSolus
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 @@
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;