Skip to content

Commit

Permalink
Merge pull request #409 from res2k/leak-docs
Browse files Browse the repository at this point in the history
Attempt to document leak detection aids
  • Loading branch information
adam-sawicki-a authored Feb 13, 2024
2 parents 38627f4 + fbf93a4 commit 6c296d3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/vk_mem_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ See also: [product page on GPUOpen](https://gpuopen.com/gaming-product/vulkan-me
- [Memory initialization](@ref debugging_memory_usage_initialization)
- [Margins](@ref debugging_memory_usage_margins)
- [Corruption detection](@ref debugging_memory_usage_corruption_detection)
- [Leak detection features](@ref debugging_memory_usage_leak_detection)
- \subpage other_api_interop
- \subpage usage_patterns
- [GPU-only resource](@ref usage_patterns_gpu_only)
Expand Down Expand Up @@ -17842,6 +17843,19 @@ Margin validation (corruption detection) works only for memory types that are
`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

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

0 comments on commit 6c296d3

Please sign in to comment.