Skip to content

sl.tag.kBufferTypeHUDLessColor.volatile.0 Leak #89

@anyiscsak

Description

@anyiscsak

When DLSS-FG is used and the device is going to be released some sl resource still keep alive and cause to fail to destroy the D3D12Device

 84.16 [D]  DX12: device's refcount after preRecovery: 3
DXGI WARNING: Live IDXGIFactory at 0x000001878AEAEAE0, Refcount: 2 [ STATE_CREATION WARNING #0: ]
D3D12 WARNING: Live ID3D12Device at 0x000001878BBF3010, Refcount: 3 [ STATE_CREATION WARNING #274: LIVE_DEVICE]
D3D12 WARNING: 	Live ID3D12Resource at 0x000001882D718030, Name: sl.tag.kBufferTypeHUDLessColor.volatile.0, Refcount: 2, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: 	Live ID3D12Resource at 0x000001882EC69BF0, Name: sl.tag.kBufferTypeHUDLessColor.volatile.0, Refcount: 2, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: 	Live ID3D12Resource at 0x000001882EC6DFC0, Name: sl.tag.kBufferTypeHUDLessColor.volatile.0, Refcount: 2, IntRef: 0 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live                 ID3D12Resource :      3 [ STATE_CREATION WARNING #255: LIVE_OBJECT_SUMMARY]

This is due to missing destructor call from ResourceTaggingGeneral
The reason is the ResourceTaggingBase is stored in a unique_ptr and due to lack of virtual destructor, the derived ResourceTaggingGeneral won't be destructed.
My fix is to add virtual destructor to the base

--- a/source/plugins/sl.common/commonInterface.h
+++ b/source/plugins/sl.common/commonInterface.h
@@ -556,6 +556,7 @@
         const sl::BaseStructure**,
         uint32_t,
         bool) = 0;

+    virtual ~ResourceTaggingBase() = default;

 protected:
     std::unordered_set<BufferTagInfo, BufferTagInfoHash> requiredTags{};

@@ -580,7 +581,7 @@
         uint32_t numInputs,
         bool optional) override final;

-    ~ResourceTaggingGeneral();
+    ~ResourceTaggingGeneral() override;
 private:
     std::map<uint64_t, CommonResource> idToResourceMap;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreadyChanges made and ready for release. Will close when “done”.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions