Attempt to document leak detection aids

This commit is contained in:
Frank Richter 2024-02-13 11:41:51 +01:00
parent 38627f4e37
commit fbf93a4270

View File

@ -77,6 +77,7 @@ See also: [product page on GPUOpen](https://gpuopen.com/gaming-product/vulkan-me
- [Memory initialization](@ref debugging_memory_usage_initialization) - [Memory initialization](@ref debugging_memory_usage_initialization)
- [Margins](@ref debugging_memory_usage_margins) - [Margins](@ref debugging_memory_usage_margins)
- [Corruption detection](@ref debugging_memory_usage_corruption_detection) - [Corruption detection](@ref debugging_memory_usage_corruption_detection)
- [Leak detection features](@ref debugging_memory_usage_leak_detection)
- \subpage other_api_interop - \subpage other_api_interop
- \subpage usage_patterns - \subpage usage_patterns
- [GPU-only resource](@ref usage_patterns_gpu_only) - [GPU-only resource](@ref usage_patterns_gpu_only)
@ -17842,6 +17843,19 @@ Margin validation (corruption detection) works only for memory types that are
`HOST_VISIBLE` and `HOST_COHERENT`. `HOST_VISIBLE` and `HOST_COHERENT`.
\section debugging_memory_usage_leak_detection Leak detection features
At allocation and allocator destruction time VMA checks for unfreed and unmapped blocks using
`VMA_ASSERT_LEAK()`. This macro defaults to an assertion, triggering a typically fatal error in Debug
builds, and doing nothing in Release builds. You can provide your own definition of `VMA_ASSERT_LEAK()`
to change this behavior.
At memory block destruction time VMA lists out all unfreed allocations using the `VMA_LEAK_LOG_FORMAT()`
macro, which defaults to `VMA_DEBUG_LOG_FORMAT`, which in turn defaults to a no-op.
If you're having trouble with leaks - for example, the aforementioned assertion triggers, but you don't
quite know \em why -, overriding this macro to print out the the leaking blocks, combined with assigning
individual names to allocations using vmaSetAllocationName(), can greatly aid in fixing them.
\page other_api_interop Interop with other graphics APIs \page other_api_interop Interop with other graphics APIs
VMA provides some features that help with interoperability with other graphics APIs, e.g. OpenGL. VMA provides some features that help with interoperability with other graphics APIs, e.g. OpenGL.