1
\$\begingroup\$

a rather quick question, I am starting on implementing rendering with deferred context into my game engine, and came across a heavy memory leak when recording command lists on my deferred contexts. Because every frame I would go like this: DeferredContext[THREAD]->FinishCommandList( 0,&commandLists[THREAD] ), it would eat up RAM, so I Release them every time, like:

if(commandLists[THREAD]){
 commandLists[THREAD]->Release();
 commandLists[THREAD] = NULL;
}

I previously only released objects when they wouldn't be used any more, so I thought there would be a more optimized way of handling this? (Like mapping dynamic *ID3D11Buffers for example?)

\$\endgroup\$
3
  • \$\begingroup\$ According to this presentation, the deferred context is supposed to reset itself upon FinishCommandList. It should not be necessary (nor is it advisable) to release and recreate the deferred contexts every frame. You do need to release the ID3D11CommandLists each frame after executing them, though. \$\endgroup\$ Aug 30, 2013 at 1:21
  • \$\begingroup\$ When you say it eats up RAM, do you mean it consumes more and more RAM over time? It makes sense that the RAM usage would grow over the first few frames due to the CPU queueing up frames for the GPU, but I would expect it to stabilize pretty quickly. \$\endgroup\$ Aug 30, 2013 at 1:22
  • \$\begingroup\$ You are right, I copy-pasted the wrong code here, I meant commandLists instead of deferredcontext, so the question is answered, then. You can cast a quick answer and I will accept it then. \$\endgroup\$ Aug 30, 2013 at 8:26

1 Answer 1

3
\$\begingroup\$

According to this NVIDIA presentation, the deferred context is supposed to reset itself upon FinishCommandList. It should not be necessary (nor is it advisable) to release and recreate the deferred contexts every frame. You do need to release the ID3D11CommandLists each frame after executing them, though.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .