mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Added constant CLEANUP_LEAKED_OBJECTS.
This commit is contained in:
parent
821e36705f
commit
f17013e699
@ -97,6 +97,10 @@ static_assert(
|
|||||||
_countof(VMA_FUNCTION_NAMES) == (size_t)VMA_FUNCTION::Count,
|
_countof(VMA_FUNCTION_NAMES) == (size_t)VMA_FUNCTION::Count,
|
||||||
"VMA_FUNCTION_NAMES array doesn't match VMA_FUNCTION enum.");
|
"VMA_FUNCTION_NAMES array doesn't match VMA_FUNCTION enum.");
|
||||||
|
|
||||||
|
// Set this to false to disable deleting leaked VmaAllocation, VmaPool objects
|
||||||
|
// and let VMA report asserts about them.
|
||||||
|
static const bool CLEANUP_LEAKED_OBJECTS = true;
|
||||||
|
|
||||||
static std::string g_FilePath;
|
static std::string g_FilePath;
|
||||||
// Most significant 16 bits are major version, least significant 16 bits are minor version.
|
// Most significant 16 bits are major version, least significant 16 bits are minor version.
|
||||||
static uint32_t g_FileVersion;
|
static uint32_t g_FileVersion;
|
||||||
@ -895,9 +899,12 @@ void Player::FinalizeVulkan()
|
|||||||
{
|
{
|
||||||
printf("WARNING: Allocations not destroyed: %zu.\n", m_Allocations.size());
|
printf("WARNING: Allocations not destroyed: %zu.\n", m_Allocations.size());
|
||||||
|
|
||||||
for(const auto it : m_Allocations)
|
if(CLEANUP_LEAKED_OBJECTS)
|
||||||
{
|
{
|
||||||
Destroy(it.second);
|
for(const auto it : m_Allocations)
|
||||||
|
{
|
||||||
|
Destroy(it.second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Allocations.clear();
|
m_Allocations.clear();
|
||||||
@ -907,8 +914,13 @@ void Player::FinalizeVulkan()
|
|||||||
{
|
{
|
||||||
printf("WARNING: Custom pools not destroyed: %zu.\n", m_Pools.size());
|
printf("WARNING: Custom pools not destroyed: %zu.\n", m_Pools.size());
|
||||||
|
|
||||||
for(const auto it : m_Pools)
|
if(CLEANUP_LEAKED_OBJECTS)
|
||||||
vmaDestroyPool(m_Allocator, it.second.pool);
|
{
|
||||||
|
for(const auto it : m_Pools)
|
||||||
|
{
|
||||||
|
vmaDestroyPool(m_Allocator, it.second.pool);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Pools.clear();
|
m_Pools.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user