Added macro VMA_LEAK_LOG_FORMAT
Fixes #379 - thanks @alecazam
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h
index 50a452f..6db6f8b 100644
--- a/include/vk_mem_alloc.h
+++ b/include/vk_mem_alloc.h
@@ -2938,6 +2938,10 @@
#define VMA_DEBUG_LOG(str) VMA_DEBUG_LOG_FORMAT("%s", (str))
#endif
+#ifndef VMA_LEAK_LOG_FORMAT
+ #define VMA_LEAK_LOG_FORMAT(format, ...) VMA_DEBUG_LOG_FORMAT(format, __VA_ARGS__)
+#endif
+
#ifndef VMA_CLASS_NO_COPY
#define VMA_CLASS_NO_COPY(className) \
private: \
@@ -6508,7 +6512,7 @@
{
if (IsVirtual())
{
- VMA_DEBUG_LOG_FORMAT("UNFREED VIRTUAL ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p", offset, size, userData);
+ VMA_LEAK_LOG_FORMAT("UNFREED VIRTUAL ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p", offset, size, userData);
}
else
{
@@ -6519,12 +6523,12 @@
const char* name = allocation->GetName();
#if VMA_STATS_STRING_ENABLED
- VMA_DEBUG_LOG_FORMAT("UNFREED ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p; Name: %s; Type: %s; Usage: %u",
+ VMA_LEAK_LOG_FORMAT("UNFREED ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p; Name: %s; Type: %s; Usage: %u",
offset, size, userData, name ? name : "vma_empty",
VMA_SUBALLOCATION_TYPE_NAMES[allocation->GetSuballocationType()],
allocation->GetBufferImageUsage());
#else
- VMA_DEBUG_LOG_FORMAT("UNFREED ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p; Name: %s; Type: %u",
+ VMA_LEAK_LOG_FORMAT("UNFREED ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p; Name: %s; Type: %u",
offset, size, userData, name ? name : "vma_empty",
(uint32_t)allocation->GetSuballocationType());
#endif // VMA_STATS_STRING_ENABLED
@@ -11345,7 +11349,8 @@
VmaVirtualBlock_T::~VmaVirtualBlock_T()
{
- // Define macro VMA_DEBUG_LOG_FORMAT to receive the list of the unfreed allocations
+ // Define macro VMA_DEBUG_LOG_FORMAT or more specialized VMA_LEAK_LOG_FORMAT
+ // to receive the list of the unfreed allocations.
if (!m_Metadata->IsEmpty())
m_Metadata->DebugLogAllAllocations();
// This is the most important assert in the entire library.
@@ -11840,7 +11845,8 @@
void VmaDeviceMemoryBlock::Destroy(VmaAllocator allocator)
{
- // Define macro VMA_DEBUG_LOG_FORMAT to receive the list of the unfreed allocations
+ // Define macro VMA_DEBUG_LOG_FORMAT or more specialized VMA_LEAK_LOG_FORMAT
+ // to receive the list of the unfreed allocations.
if (!m_pMetadata->IsEmpty())
m_pMetadata->DebugLogAllAllocations();
// This is the most important assert in the entire library.