Open ghost opened 9 months ago
Function vmaCreateBuffer
creates two objects: VkBuffer
and VmaAllocation
. When the buffer is no longer needed, you should destroy them both by passing them to vmaDestroyBuffer
. Do you pass them both, the buffer and the allocation object?
An allocation represents a piece of device memory.
VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT
flag) to create a dedicated memory block for the allocation, it would represent a separate VkDeviceMemory
object. It will get destroyed when you pass the allocation to vmaDestroyBuffer
.You don't need to think about it as long as you respect the correct order of deinitialization, which is:
for each buffer:
vmaDestroyBuffer(g_Allocator, buffer[i], bufferAllocation[i]);
vmaDestroyAllocator(g_Allocator);
vkDestroyDevice(...);
So, my main question is: Did you call vmaDestroyAllocator
?
I have the same question and calling the vmaDestroyAllocator didnt do the trick
I managed to do a very brief MRE, minimal reproducible example.
vmaDestroyBuffer(m_allocator, m_vertex_buffer.buffer, m_vertex_buffer.allocation);
vmaDestroyAllocator(m_allocator);
e.g.
[2024-03-29 17:47:02.921] [info] validation layer: Validation Error: [ VUID-vkDestroyDevice-device-05137 ] Object 0: handle = 0x908683000000001d, type = VK_OBJECT_TYPE_DEVICE_MEMORY; | MessageID = 0x4872eaa0 | vkCreateDevice(): OBJ ERROR : For VkDevice 0x11729a118[], VkDeviceMemory 0x908683000000001d[] has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device
Do make sure to destroy the allocator prior to the device according to deinitialization order as mentioned by @adam-sawicki-a ; not doing so is only case where I seem to be able to reproduce that error
When I vmaDestroyBuffer(), at object destruction, it doesn't destroy VkDeviceMemory hMemory, resulting in error:
after i destroy my device.