0
\$\begingroup\$

I'm working on the fifth iteration of my game engine, this time in C++ and Direct3D12.

While I was working on supporting delayed object deletion, I started getting messages on the console about object leaks when the process finished:

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 0x00000234A0FD24D8, Refcount: 2. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING:  Live Object at 0x00000234A0FA14A0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING:  Live Object at 0x00000234A0FA3740, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING:  Live Object at 0x00000234A0FA58E0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING:  Live Object at 0x00000234A0FA72A0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING:  Live Object at 0x00000234A0FA6A30, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING:  Live Object at 0x00000234A0FAD790, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING:  Live Object at 0x00000234A0FAD9C0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING:  Live Object at 0x00000234A0FAEAD0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D12 WARNING: Live                         Object :      8 [ STATE_CREATION WARNING #0: UNKNOWN]
DXGI WARNING: Live Producer at 0x00000234A0FF96D8, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING:   Live Object at 0x00000234A0FF99E0, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live                         Object :      1 [ STATE_CREATION WARNING #0: ]

I found that to be unusual, so I added some code to call ReportLiveDeviceObjects before the Direct3D device was destroyed. The output was something like this:

D3D12 WARNING: Live ID3D12Device at 0x00000234A0FD24F8, Refcount: 45 [ STATE_CREATION WARNING #274: LIVE_DEVICE]
D3D12 WARNING:  Live ID3D12RootSignature at 0x00000234A0FA14A0, Refcount: 0, IntRef: 2 [ STATE_CREATION WARNING #577: LIVE_ROOTSIGNATURE]
D3D12 WARNING:  Live ID3D12PipelineState at 0x00000234A0FA3740, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #572: LIVE_PIPELINESTATE]
D3D12 WARNING:  Live ID3D12PipelineState at 0x00000234A0FA58E0, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #572: LIVE_PIPELINESTATE]
D3D12 WARNING:  Live ID3D12Resource at 0x00000234A0FA72A0, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING:  Live ID3D12Heap at 0x00000234A0FA6A30, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING:  Live ID3D12Fence at 0x00000234A0FAD790, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING:  Live ID3D12CommandQueue at 0x00000234A0FAD9C0, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #570: LIVE_COMMANDQUEUE]
D3D12 WARNING:  Live ID3D12Fence at 0x00000234A0FAEAD0, Name: Internal D3D12 Debug Fence, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING:  Live ID3D12CommandQueue at 0x00000234A0FAED00, Refcount: 5, IntRef: 0 [ STATE_CREATION WARNING #570: LIVE_COMMANDQUEUE]
D3D12 WARNING:  Live ID3D12Fence at 0x00000234A0FB3470, Name: Internal D3D12 Debug Fence, Refcount: 0, IntRef: 9 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING:  Live ID3D12CommandQueue at 0x00000234A0FB56B0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #570: LIVE_COMMANDQUEUE]
D3D12 WARNING:  Live ID3D12Fence at 0x00000234A0FB9120, Name: Internal D3D12 Debug Fence, Refcount: 0, IntRef: 3 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING:  Live IDXGISwapChain at 0x00000234A0FB9B60, Refcount: 2 [ STATE_CREATION WARNING #275: LIVE_SWAPCHAIN]
D3D12 WARNING:  Live ID3D12Fence at 0x00000234A0FBB660, Name: Internal DXGI Fence, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234A0FBC8A0, Name: Internal DXGI CommandAllocator, Refcount: 1, IntRef: 1 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234A0FBDD30, Name: Internal DXGI CommandList, Refcount: 2, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E4150110, Name: D3D12 Debug Layer Indirect Command List, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12Resource at 0x00000234A0FCCF70, Refcount: 2, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING:  Live ID3D12Heap at 0x00000234A0FCC700, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING:  Live ID3D12Resource at 0x00000234A0FCE1E0, Refcount: 2, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING:  Live ID3D12Heap at 0x00000234A0FCD970, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #579: LIVE_HEAP]
D3D12 WARNING:  Live ID3D12Fence at 0x00000234A0FCEBE0, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING:  Live ID3D12DescriptorHeap at 0x00000234A0FCEE10, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #576: LIVE_DESCRIPTORHEAP]
D3D12 WARNING:  Live ID3D12DescriptorHeap at 0x00000234E415B1B0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #576: LIVE_DESCRIPTORHEAP]
D3D12 WARNING:  Live ID3D12DescriptorHeap at 0x00000234E4161EB0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #576: LIVE_DESCRIPTORHEAP]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234A0FCFC70, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234A0FD00F0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234A0FD0570, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234A0FD09F0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234A0FD0E70, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E416B1C0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E416C410, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E416CF50, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E416C1D0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E416B690, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E416CAD0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E416C890, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E416CD10, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E4174140, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E4172D00, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E4172400, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E4173600, Refcount: 1, IntRef: 4 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E4174680, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E417F980, Name: D3D12 Debug Layer Indirect Command List, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E418AA20, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E4195AC0, Name: D3D12 Debug Layer Indirect Command List, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E4171440, Refcount: 1, IntRef: 4 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E41A0B60, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E3FF00B0, Name: D3D12 Debug Layer Indirect Command List, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E3FFB150, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E40061F0, Name: D3D12 Debug Layer Indirect Command List, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E4171B00, Refcount: 1, IntRef: 2 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E4011290, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12GraphicsCommandList at 0x00000234E4019D80, Name: D3D12 Debug Layer Indirect Command List, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #573: LIVE_COMMANDLIST12]
D3D12 WARNING:  Live ID3D12Fence at 0x00000234E41AC8D0, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING:  Live ID3D12Fence at 0x00000234E41ACB00, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #580: LIVE_MONITOREDFENCE]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E4172640, Name: Internal DXGI CommandAllocator, Refcount: 1, IntRef: 1 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]
D3D12 WARNING:  Live ID3D12CommandAllocator at 0x00000234E41733C0, Name: Internal DXGI CommandAllocator, Refcount: 1, IntRef: 0 [ STATE_CREATION WARNING #571: LIVE_COMMANDALLOCATOR]

By comparing the object addresses, it seems like I'm leaking a root signature, two pipeline states, a resource, a fence, a command queue, and an "Internal D3D12 Debug Fence", in addition to some DXGI objects.

This is quite peculiar, because when reproducing this issue, I removed all non-essential code, and I am 100% positive I am at least never creating any root signatures or pipeline states. In fact, all the objects I am indeed creating are all accounted for, and none are in the list of leaked objects.

I'm starting to think this might be a driver bug, or something outside of my control. I have found some mentions of cached objects that are not deleted when using AMP (I'm not using AMP though), and a suggestion not to care much about leaked resources on process termination. However, not caring about this has two downsides:

  • There might actually be a leak in some part of the code that I'm missing. I should catch this one.
  • If I start ignoring this message, I might miss a potential leak that appears in the future.

Are these object leaks safe to ignore? Is there anything I can do to prevent these objects from leaking?

\$\endgroup\$
  • 1
    \$\begingroup\$ here they suggest to set the D3D12_RLDO_IGNORE_INTERNAL flag; Maybe ignoring them is the only option :( \$\endgroup\$ – Gabriele Vierti Dec 25 '18 at 9:40

Your Answer

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

Browse other questions tagged or ask your own question.