fix memory leaks, nodes in HwQueueContext · GameTechDev/PresentMon@1e913d6 (original) (raw)
Commit 1e913d6
fix memory leaks, nodes in HwQueueContext
2 files changed
Lines changed: 11 additions & 0 deletions
File tree
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -75,6 +75,16 @@ GpuTrace::GpuTrace(PMTraceConsumer* pmConsumer) | ||
| 75 | 75 | { |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | +GpuTrace::~GpuTrace() | |
| 79 | +{ | |
| 80 | +for (auto& pair : mContexts) { | |
| 81 | +auto context = pair.second; | |
| 82 | +if (context.mIsHwQueue) { | |
| 83 | +delete context.mNode; | |
| 84 | + } | |
| 85 | + } | |
| 86 | +} | |
| 87 | + | |
| 78 | 88 | void GpuTrace::RegisterDevice(uint64_t hDevice, uint64_t pDxgAdapter) |
| 79 | 89 | { |
| 80 | 90 | // Sometimes there are duplicate start events |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -75,6 +75,7 @@ class GpuTrace { | ||
| 75 | 75 | |
| 76 | 76 | public: |
| 77 | 77 | explicit GpuTrace(PMTraceConsumer* pmConsumer); |
| 78 | +~GpuTrace(); | |
| 78 | 79 | |
| 79 | 80 | void RegisterDevice(uint64_t hDevice, uint64_t pDxgAdapter); |
| 80 | 81 | void UnregisterDevice(uint64_t hDevice); |