I have used the debug layer of directx and here is the output when my application exits:
I have also tried deleaker and it hasn't found anything.
D3D11 WARNING: Live ID3D11Device at 0x006C611C, Refcount: 3 [ STATE_CREATION WARNING #441: LIVE_DEVICE]
D3D11 WARNING: Live ID3D11Context at 0x006C9010, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #2097226: LIVE_CONTEXT]
D3D11 WARNING: Live ID3DDeviceContextState at 0x006D3010, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #3145742: LIVE_DEVICECONTEXTSTATE]
D3D11 WARNING: Live ID3D11BlendState at 0x006D9124, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #435: LIVE_BLENDSTATE]
D3D11 WARNING: Live ID3D11DepthStencilState at 0x006D926C, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #436: LIVE_DEPTHSTENCILSTATE]
D3D11 WARNING: Live ID3D11RasterizerState at 0x006D93DC, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #437: LIVE_RASTERIZERSTATE]
D3D11 WARNING: Live ID3D11Sampler at 0x006D962C, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #434: LIVE_SAMPLER]
D3D11 WARNING: Live ID3D11Query at 0x006D9774, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #438: LIVE_QUERY]
D3D11 WARNING: Live IDXGISwapChain at 0x006D98C0, Refcount: 0 [ STATE_CREATION WARNING #442: LIVE_SWAPCHAIN]
D3D11 WARNING: Live ID3D11Texture2D at 0x006C185C, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #425: LIVE_TEXTURE2D]
D3D11 WARNING: Live ID3D11RenderTargetView at 0x006C260C, Refcount: 0, IntRef: 0 [ STATE_CREATION WARNING #428: LIVE_RENDERTARGETVIEW]
D3D11 WARNING: Live ID3D11Texture2D at 0x006C298C, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #425: LIVE_TEXTURE2D]
D3D11 WARNING: Live ID3D11DepthStencilView at 0x006C242C, Refcount: 0, IntRef: 0 [ STATE_CREATION WARNING #429: LIVE_DEPTHSTENCILVIEW]
D3D11 WARNING: Live ID3D11VertexShader at 0x006C327C, Refcount: 0, IntRef: 0 [ STATE_CREATION WARNING #430: LIVE_VERTEXSHADER]
D3D11 WARNING: Live ID3D11InputLayout at 0x006C3044, Refcount: 0, IntRef: 0 [ STATE_CREATION WARNING #433: LIVE_INPUTLAYOUT]
D3D11 WARNING: Live ID3D11PixelShader at 0x006DA8A4, Refcount: 0, IntRef: 0 [ STATE_CREATION WARNING #432: LIVE_PIXELSHADER]
D3D11 WARNING: Live ID3D11Buffer at 0x006F2A64, IntRef: 0 [ STATE_CREATION WARNING #423: LIVE_BUFFER]
D3D11 WARNING: Live ID3D11Buffer at 0x006F2CBC, IntRef: 0 [ STATE_CREATION WARNING #423: LIVE_BUFFER]
D3D11 WARNING: Live ID3D11Buffer at 0x006F1E54, IntRef: 0 [ STATE_CREATION WARNING #423: LIVE_BUFFER]
D3D11 WARNING: Live ID3D11Buffer at 0x006F345C, IntRef: 0 [ STATE_CREATION WARNING #423: LIVE_BUFFER]
D3D11 WARNING: Live ID3D11Buffer at 0x006F36B4, IntRef: 0 [ STATE_CREATION WARNING #423: LIVE_BUFFER]
D3D11 WARNING: Live ID3D11Texture2D at 0x006F390C, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #425: LIVE_TEXTURE2D]
D3D11 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Producer at 0x006C6190, Refcount: 2. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006C9010, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006D3010, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006D9124, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006D926C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006D93DC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006D962C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006D9774, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006D98C0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006C185C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006C260C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006C298C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006C242C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006C327C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006C3044, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006DA8A4, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006F2A64, Refcount: -1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006F2CBC, Refcount: -1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006F1E54, Refcount: -1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006F345C, Refcount: -1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006F36B4, Refcount: -1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x006F390C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
so that all looks okay to me. I have ran one before and after rendering and they are the same and as expected. However as I've stepped through this many times the memory usage only goes up sometimes and not every render call.
Nothing in your posted code directly increases any reference counts on objects (DrawIndexed() does not leak memory).
You will need to post code that actually modifies object reference counts before anyone can guide you.
What does GetPurgeModel() do?
Side-note: A list is probably the worst way to implement a render queue (it would be faster to just render straight). It should be a plain-ol’-data vector with a matching index array which gets sorted.
L. Spiro
I completely agree, it doesn't increase reference count and that's why I'm confused about memory going up and not going up when its commented out...
The GetModel method just returns a pointer to a model.
I was using a list because I was planning on sorting that but using an index array sounds good.
It seems like I am chasing a red herring at the moment and the problem is somewhere else as ankhd said, any ideas?