I've come across a strange thing in DirectX 11:

I'm trying to implement large scale volume visualization engine. My approach is like this: if the volume is HUGE (could not fit to GPU memory directly), tile it into smaller "volume bricks". render all of those bricks separately (offscreen) and blend them properly to screenbuffer.

I've read, that DX11 manages GPU memory by itself. But for volumes > 4GB I've got unexpected exceptions, when trying to create further resources. (using 64bit system - so no 32bit limit should be present)

So I implemented my own GPU memory manager, which handles resource allocations, and if there should be allocated more, than GPU memory size, all previously created resources are transferred to RAM and DX resource is released.

But the DX behavior is the same.

I'm also calling DeviceContext.Flush() after every release of resource. (to make it really happen)

It seems to me, that DX is not releasing and deallocating resources properly. (Or am I missing something?). Could it be problem, that all this alloc/dealloc operations are done within one frame?

I'm getting mad about this. (even tried to setup eviction priorities of resources, but no luck.)

Thanks for any advice.

  • \$\begingroup\$ Since DX only provides an interface to the device driver, each call can technically act differently based on the driver/card. So you could try it on a different card to confirm the problems are device independent, and then it would also be good to know what the exceptions you were getting were. \$\endgroup\$ Oct 16, 2013 at 13:21
  • \$\begingroup\$ The "Visual Studio Graphics Debugger" may also provide more insight into the problem at hand. \$\endgroup\$ Oct 16, 2013 at 13:23
  • \$\begingroup\$ I'am limited to use VS 2008 (without Graphic Debugger). But I enabled DebugLayer on my device and when analyzing the output, I've discovered, that if I call ULONG r = pTexture->Release(); , then r = 0, but no "D3D11 INFO: Destroy ID3D11Texture3D" is printed out. So I suspect DX really not releasing the resource allocated in GPU memory. \$\endgroup\$
    – GPUquant
    Oct 16, 2013 at 13:50
  • \$\begingroup\$ I can imagine, that this could be because of some internal optimization. But in this case it is causing memory overfill problems... \$\endgroup\$
    – GPUquant
    Oct 16, 2013 at 13:53

1 Answer 1


You should avoid allocating and deallocating resources multiple times per frame. Instead, you should create a single "brick" volume (or how ever many you need concurrently to perform a single Draw call) with usage type DYNAMIC. Then use Map with DISCARD flag to update the contents on the fly.

Regarding the problem with your current approach, this is likely due to some stray ID3D11View*s (e.g. ShaderResourceView) that you're failing to destroy or unbind. You must destroy and unbind all objects associated with the resource in order for it to be destroyed.

  • \$\begingroup\$ Thanks a lot MooseBoys! I'll try that. This was exactly what I was thinking, but I couldn't find it clearly stated anywhere. \$\endgroup\$
    – GPUquant
    Oct 17, 2013 at 7:09

You must log in to answer this question.

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