DirectX CreateBuffer Memory Leaks

682 views Asked by At

I want to write a benchmark app to test write speed from system memory to GPU memory using DirectX api. But even if I just createBuffer and release in a for loop, the memory diagnosis tools shows that the process's private bytes size is constantly increasing. I think it might be because GPU mapped system memory is never released. BTW, The heap size is stable.

 1. FOR 1000 iteration
 2. CreateBuffer using 
               D3D11_USAGE_STAGING/D3D11_USAGE_DYNAMIC 
               & D3D11_CPU_ACCESS_WRITE
 3. d3dbuffer.Release & d3dbuffer = nullptr

Is there anyone could explain how to properly release it? Is this the so-called mapped AGP memory?

1

There are 1 answers

2
Chuck Walbourn On

Direct3D uses delayed resource destruction. If you want to force all resources to be cleaned up, you need to call Flush. Writing effective Direct3D benchmarks is quite challenging as there are many things at play you are probably missing.

For some sense of this, read Accurately Profiling Direct3D API Calls and see Profiling DirectX Apps