D3D12MemoryAllocator icon indicating copy to clipboard operation
D3D12MemoryAllocator copied to clipboard

Questions about Defragmentation Thread Safety

Open rbertin-aso opened this issue 2 years ago • 0 comments

Hello Adam ! Small question regarding defragmentation.

In the documentation it is written :

What it means in practice is that you shouldn't free any allocations from the defragmented pool since the moment a call to BeginPass begins.

One solution that you give is :

A solution to freeing allocations during defragmentation is to find such allocation on the list pass.pMoves[i] and set its operation to D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_DESTROY instead of calling allocation->Release()

However, it is only possible to set the operation after having the pass moves (after the return of the call). Do I need to keep track of allocations that want to be released during computation time or won't it be an issue if releasing occurs ? Could it be simpler to just add a reference to allocations that ends up being part of a move and remove a reference at the end of the pass ?

Hope those questions are not stupid :) Have a nice day !

rbertin-aso avatar Sep 23 '22 14:09 rbertin-aso