D3D12 Memory Allocator

Drivers, SDKs and Libraries

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

Currently at version 1.0.0, D3D12MA has the following key features:

  • Allocates and keeps track of bigger memory heaps, used and unused ranges inside them, finds best matching unused ranges to create new resources there as placed resources.
  • Automatically respects alignment requirements for created resources.
  • Automatically handles resource heap tier – whether it’s D3D12_RESOURCE_HEAP_TIER_1 that requires to keep certain classes of resources separate or D3D12_RESOURCE_HEAP_TIER_2 that allows to keep them all together.

Additional features:

  • Well-documented – description of all classes and functions provided, along with chapters that contain general description and example code.
  • Thread-safety: Library is designed to be used in multithreaded code.
  • Configuration: Fill optional members of ALLOCATOR_DESC structure to provide custom CPU memory allocator and other parameters.
  • Customization: Predefine appropriate macros to provide your own implementation of external facilities used by the library, like assert, mutex, and atomic.
  • Statistics: Obtain detailed statistics about the amount of memory used, unused, number of allocated blocks, number of allocations etc. – globally and per memory heap type.
  • Debug annotations: Associate string name with every allocation.

You can find the project as D3D12MemoryAllocator repository on GitHub. The repository also includes documentation and a sample application that shows how the library can be used.