D3D12 resources not being released
BruOp opened this issue · 0 comments
Hi there, thanks for the great profiler!
Recently I instrumented my D3D12 app and noticed that OPTICK_GPU_INIT_D3D12
allocates a few resources (included in the output below) that do not get released, causing the D3D12 validation layers to issue a warning. The issue with that is that this warning is useful to ensure that my application code isn't leaking any of the resources, so having the warning always pop up makes it harder to understand when I've broken something.
I'm using Windows 10 with Microsoft Visual Studio 17 2019 using an Nvidia 960m.
To reproduce, I actually just ran the D3D12 Multithreading example in the Debug configuration, and after closing the application the following is printed in the 'Output' tab:
D3D12 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Producer at 0x000001D0095BF2D8, Refcount: 11. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D007A5E770, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D009600E10, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D0096208F0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00962E660, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D007AE8500, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D009632CF0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D0096467D0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D009623C40, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E5D4B90, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E5C9080, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00C343870, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E44B310, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E80CFB0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00C30BD30, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00C347800, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E80BBB0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E9D5210, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E9D9A40, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E80C5B0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E9DE270, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E9E2AA0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E80C0B0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E9F72E0, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object at 0x000001D00E9FBB10, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live Object : 24 [ STATE_CREATION WARNING #0: UNKNOWN]
The program '[3808] WindowsD3D12.exe' has exited with code 0 (0x0).
In my application, I called ID3D12DebugDevice::ReportLiveDeviceObjects
right before I release the ID3D12Device, after I've released all the D3D resources that my application code creates. Here's the output:
D3D12 WARNING: Live ID3D12Device at 0x00000252317C01F8, Refcount: 13 [ STATE_CREATION WARNING #274: LIVE_DEVICE]
D3D12 WARNING: Live ID3D12Resource at 0x0000025238CEE080, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12QueryHeap at 0x0000025238AEF2B0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #581: LIVE_QUERYHEAP]
D3D12 WARNING: Live ID3D12Fence at 0x0000025238C87530, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING: Live ID3D12CommandAllocator at 0x0000025238C92B10, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x000002523186FBE0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12CommandAllocator at 0x0000025238C94910, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x00000252391EBFB0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12CommandAllocator at 0x0000025238C91E90, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x00000252392014D0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING: Live ID3D12CommandAllocator at 0x0000025238C94410, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING: Live ID3D12GraphicsCommandList at 0x0000025239210100, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
Which are all the resources that Optick creates.
My understanding of Optick isn't comprehensive, but it might be helpful to have an OPTICK_GPU_SHUTDOWN_D3D12
(and one for Vulkan, maybe) to ensure that everything is getting cleaned up properly.