mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-30 02:04:35 +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,10 +899,13 @@ void Player::FinalizeVulkan()
|
|||||||
{
|
{
|
||||||
printf("WARNING: Allocations not destroyed: %zu.\n", m_Allocations.size());
|
printf("WARNING: Allocations not destroyed: %zu.\n", m_Allocations.size());
|
||||||
|
|
||||||
|
if(CLEANUP_LEAKED_OBJECTS)
|
||||||
|
{
|
||||||
for(const auto it : m_Allocations)
|
for(const auto it : m_Allocations)
|
||||||
{
|
{
|
||||||
Destroy(it.second);
|
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());
|
||||||
|
|
||||||
|
if(CLEANUP_LEAKED_OBJECTS)
|
||||||
|
{
|
||||||
for(const auto it : m_Pools)
|
for(const auto it : m_Pools)
|
||||||
|
{
|
||||||
vmaDestroyPool(m_Allocator, it.second.pool);
|
vmaDestroyPool(m_Allocator, it.second.pool);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Pools.clear();
|
m_Pools.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user