Vulkan® Memory Allocator
The Vulkan® Memory Allocator (VMA) library provides a simple and easy to integrate API to help you allocate memory for Vulkan® buffer and image storage.
Download the latest version - v3.0.0
*We recommend using the code from the master branch.
This release adds the following features:
- Added new API for selecting preferred memory type
- Added new defragmentation API and algorithm, replacing the old one.
- Redesigned API for statistics, replacing the old one.
- Added “Virtual allocator” feature – possibility to use core allocation algorithms for allocation of custom memory, not necessarily Vulkan device memory.
- VmaAllocation now keeps both
void* pUserData
andchar* pName
. Added functionvmaSetAllocationName
and memberVmaAllocationInfo::pName
. - Clarified and cleaned up various ways of importing Vulkan functions. Added members
VmaVulkanFunctions::vkGetInstanceProcAddr
, andvkGetDeviceProcAddr
, which are now required when usingVMA_DYNAMIC_VULKAN_FUNCTIONS
.
Benefits
The library is battle-ready, and integrated into the majority of Vulkan® game titles on PC, as well as the Google Filament rendering engine, the official Khronos® Group Vulkan® Samples, and many other open source projects for Android™, Linux, MacOS, and Windows®.
This library can help game developers to manage memory allocations and resource creation by offering some higher-level functions:
- Functions that help to choose correct and optimal memory type based on intended usage of the memory.
- Required or preferred traits of the memory are expressed using higher-level description comparing to Vulkan flags.
- Functions that allocate memory blocks, reserve and return parts of them (
VkDeviceMemory
+ offset + size) to the user.- Library keeps track of allocated memory blocks, used and unused ranges inside them, finds best matching unused ranges for new allocations, respects all the rules of alignment and buffer/image granularity.
- Functions that can create an image/buffer, allocate memory for it and bind them together – all in one call.
Additional features
- Self-contained C++ library in single header file. No external dependencies other than the standard C and C++ library and Vulkan.
- Public interface in C, in same convention as Vulkan API. Implementation in C++.
- Platform-independent, but developed and tested on Windows using Visual Studio. Continuous integration setup for Windows and Linux. Used also on Android, MacOS, and other platforms.
- Support for memory mapping, reference-counted internally.
- Support for persistently mapped memory: Just allocate with appropriate flag and access the pointer to already mapped memory.
- Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer fashion.
- Defragmentation of GPU and CPU memory: Let the library move data around to free some memory blocks and make your allocations better compacted.
- Statistics: Obtain brief or detailed statistics about the amount of memory used, unused, number of allocated blocks, number of allocations etc. - globally, per memory heap, and per memory type.
- Debug annotations: Associate custom void* pUserData and debug char* pName with each allocation.
- JSON dump: Output a JSON string with detailed map of internal state, including allocations, their string names, and gaps between them.
- Convert JSON dump into a picture to visualize your memory.
- Support for interoperability with OpenGL.
- Virtual allocator: Interface for using core allocation algorithm to allocate any custom data, e.g. pieces of one large buffer.



Version history
- New, more powerful defragmentation:
- Added structure
VmaDefragmentationInfo2
, functionsvmaDefragmentationBegin
,vmaDefragmentationEnd
. - Added support for defragmentation of GPU memory.
- Defragmentation of CPU memory now uses
memmove
, so it can move data to overlapping regions. - Defragmentation of CPU memory is now available for memory types that are
HOST_VISIBLE
but notHOST_COHERENT
. - Added structure member
VmaVulkanFunctions::vkCmdCopyBuffer
. - Major internal changes in defragmentation algorithm.
- VmaReplay: added parameters:
--DefragmentAfterLine
,--DefragmentationFlags
. - Old interface (structure
VmaDefragmentationInfo
, functionvmaDefragment
) is now deprecated.
- Added structure
- Added buddy algorithm, available for custom pools – flag
VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT
. - Added convenience functions for multiple allocations and deallocations at once, intended for sparse binding resources – functions
vmaAllocateMemoryPages
,vmaFreeMemoryPages
. - Added function that tries to resize existing allocation in place:
vmaResizeAllocation
. - Added flags for allocation strategy:
VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT
,VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT
,VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT
, and their aliases:VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT
,VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT
,VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT
.
- Added linear allocation algorithm, accessible for custom pools, that can be used as free-at-once, stack, double stack, or ring buffer. See “Linear allocation algorithm” documentation chapter.
- Added
VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT
,VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT
.
- Added
- Added feature to record sequence of calls to the library to a file and replay it using dedicated application. See documentation chapter “Record and replay”.
- Recording: added
VmaAllocatorCreateInfo::pRecordSettings
. - Replaying: added VmaReplay project.
- Recording file format: added document “docs/Recording file format.md”.
- Recording: added
- Improved support for non-coherent memory.
- Added functions:
vmaFlushAllocation
,vmaInvalidateAllocation
. nonCoherentAtomSize
is now respected automatically.- Added
VmaVulkanFunctions::vkFlushMappedMemoryRanges
,vkInvalidateMappedMemoryRanges
.
- Added functions:
- Improved debug features related to detecting incorrect mapped memory usage. See documentation chapter “Debugging incorrect memory usage”.
- Added debug macro
VMA_DEBUG_DETECT_CORRUPTION
, functionsvmaCheckCorruption
,vmaCheckPoolCorruption
. - Added debug macro
VMA_DEBUG_INITIALIZE_ALLOCATIONS
to initialize contents of allocations with a bit pattern. - Changed behavior of
VMA_DEBUG_MARGIN
macro – it now adds margin also before first and after last allocation in a block.
- Added debug macro
- Changed format of JSON dump returned by
vmaBuildStatsString
(not backward compatible!).- Custom pools and memory blocks now have IDs that don’t change after sorting.
- Added properties: “CreationFrameIndex”, “LastUseFrameIndex”, “Usage”.
- Changed VmaDumpVis tool to use these new properties for better coloring.
- Changed behavior of
vmaGetAllocationInfo
andvmaTouchAllocation
to updateallocation.lastUseFrameIndex
even if allocation cannot become lost.
- Introduction of
VmaAllocation
handle that you must retrieve from allocation functions and pass to deallocation functions next to normalVkBuffer
andVkImage
. - Introduction of
VmaAllocationInfo
structure that you can retrieve fromVmaAllocation
handle to access parameters of the allocation (likeVkDeviceMemory
and offset) instead of retrieving them directly from allocation functions. - Support for reference-counted mapping and persistently mapped allocations – see
vmaMapMemory
,VMA_ALLOCATION_CREATE_MAPPED_BIT
. - Support for custom memory pools – see
VmaPool
handle,VmaPoolCreateInfo
structure,vmaCreatePool
function. - Support for defragmentation (compaction) of allocations – see function
vmaDefragment
and related structures. - Support for “lost allocations” – see appropriate chapter on documentation Main Page.
- Initial release.
Related to Vulkan® Memory Allocator

Announcing Vulkan Memory Allocator 3.0.0 and Direct3D 12 Memory Allocator 2.0.0
Find out more about the latest releases of VMA and D3DMA – our easy-to-integrate memory allocation libraries for Vulkan® and Direct3D® 12.

Efficient Use of GPU Memory in Modern Games – Digital Dragons 2021
This Digital Dragons 2021 talk presents the current state of access to memory resources through the DirectX® 12 and Vulkan® APIs.

How to get the most out of Smart Access Memory (SAM)
Smart Access Memory (SAM) provides the CPU with direct access to all video memory. These guidelines help you to improve CPU and GPU performance using SAM.

Memory Management in Vulkan® – YouTube link
This talk by AMD’s Ste Tovey discusses memory management with Vulkan® at Vulkanised 2018.

Unified Radeon™ GPU Profiler and Radeon™ Memory Visualizer usage with Radeon™ Developer Panel 2.1
This tutorial explains how to take advantage of the functionality in RDP v2.1 onwards, which unifies the RMV and RGP functionality from earlier versions to provide a unified workflow.

Porting Detroit: Become Human from PlayStation® 4 to PC – Part 3
The final part of this joint series with Quantic Dream discusses shader scalarization, async compute, multithreaded render lists, memory management using our Vulkan Memory Allocator (VMA), and much more.

Radeon™ Memory Visualizer
Radeon™ Memory Visualizer (RMV) is a tool to allow you to gain a deep understanding of how your application uses memory for graphics resources.

D3D12 Memory Allocator
The D3D12 Memory Allocator (D3D12MA) is a C++ library that provides a simple and easy-to-integrate API to help you allocate memory for DirectX®12 buffers and textures.

Understanding Vulkan® Objects
An important part of learning the Vulkan® API is to understand what types of objects are defined in it, what they represent and how they relate to each other.
Our other SDKs

HIP RT is a ray tracing library for HIP, making it easy to write ray tracing applications in HIP.

Orochi is a library which loads HIP and CUDA® APIs dynamically, allowing the user to switch APIs at runtime.

AMD Radeon™ ProRender is our fast, easy, and incredible physically-based rendering engine built on industry standards that enables accelerated rendering on virtually any GPU, any CPU, and any OS in over a dozen leading digital content creation and CAD applications.

Radeon™ Machine Learning (Radeon™ ML or RML) is an AMD SDK for high-performance deep learning inference on GPUs.

Harness the power of machine learning to enhance images with denoising, enabling your application to produce high quality images in a fraction of the time traditional denoising filters take.

The Advanced Media Framework SDK provides developers with optimal access to AMD GPUs for multimedia processing.

The D3D12 Memory Allocator (D3D12MA) is a C++ library that provides a simple and easy-to-integrate API to help you allocate memory for DirectX®12 buffers and textures.

The AMD Display Library (ADL) SDK is designed to access display driver functionality for AMD Radeon™ and AMD FirePro™ graphics cards.

The AMD GPU Services (AGS) library provides software developers with the ability to query AMD GPU software and hardware state information that is not normally available through standard operating systems or graphics APIs.

AMD TrueAudio Next is a software development kit for GPU accelerated and multi-core high-performance audio signal processing.

AMD Radeon™ ProRender is a powerful physically-based path traced rendering engine that enables creative professionals to produce stunningly photorealistic images.

The lightweight accelerated ray intersection library for DirectX®12 and Vulkan®.