Skip to content

Commit fbf93a4

Browse files
committed
Attempt to document leak detection aids
1 parent 38627f4 commit fbf93a4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

include/vk_mem_alloc.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ See also: [product page on GPUOpen](https://gpuopen.com/gaming-product/vulkan-me
7777
- [Memory initialization](@ref debugging_memory_usage_initialization)
7878
- [Margins](@ref debugging_memory_usage_margins)
7979
- [Corruption detection](@ref debugging_memory_usage_corruption_detection)
80+
- [Leak detection features](@ref debugging_memory_usage_leak_detection)
8081
- \subpage other_api_interop
8182
- \subpage usage_patterns
8283
- [GPU-only resource](@ref usage_patterns_gpu_only)
@@ -17842,6 +17843,19 @@ Margin validation (corruption detection) works only for memory types that are
1784217843
`HOST_VISIBLE` and `HOST_COHERENT`.
1784317844

1784417845

17846+
\section debugging_memory_usage_leak_detection Leak detection features
17847+
17848+
At allocation and allocator destruction time VMA checks for unfreed and unmapped blocks using
17849+
`VMA_ASSERT_LEAK()`. This macro defaults to an assertion, triggering a typically fatal error in Debug
17850+
builds, and doing nothing in Release builds. You can provide your own definition of `VMA_ASSERT_LEAK()`
17851+
to change this behavior.
17852+
17853+
At memory block destruction time VMA lists out all unfreed allocations using the `VMA_LEAK_LOG_FORMAT()`
17854+
macro, which defaults to `VMA_DEBUG_LOG_FORMAT`, which in turn defaults to a no-op.
17855+
If you're having trouble with leaks - for example, the aforementioned assertion triggers, but you don't
17856+
quite know \em why -, overriding this macro to print out the the leaking blocks, combined with assigning
17857+
individual names to allocations using vmaSetAllocationName(), can greatly aid in fixing them.
17858+
1784517859
\page other_api_interop Interop with other graphics APIs
1784617860

1784717861
VMA provides some features that help with interoperability with other graphics APIs, e.g. OpenGL.

0 commit comments

Comments
 (0)