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\$
  • \$\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\$ – Nathan Reed Aug 30 '13 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\$ – Nathan Reed Aug 30 '13 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\$ – János Turánszki Aug 30 '13 at 8:26
2
\$\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\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.