fix memory leak (#11700)

This commit is contained in:
minggo
2022-06-27 09:54:47 +08:00
committed by GitHub
parent 7ce49b2673
commit 9fb1d85642
2 changed files with 6 additions and 2 deletions
@@ -52,6 +52,7 @@ void BatchedBuffer::destroyBatchedBuffer() {
BatchedBuffer *batchedBuffer = item.second;
if (batchedBuffer) {
batchedBuffer->destroy();
delete batchedBuffer;
}
}
}
@@ -74,11 +74,14 @@ public:
inline const DynamicOffsetList &getDynamicOffset() const { return _dynamicOffsets; }
private:
// uint32_t: extraKey, passed in BatchedBuffer::get();
static ccstd::unordered_map<scene::Pass *, ccstd::unordered_map<uint32_t, BatchedBuffer *>> buffers;
DynamicOffsetList _dynamicOffsets;
BatchedItemList _batches;
const scene::Pass *_pass = nullptr;
gfx::Device *_device = nullptr;
// weak reference
const scene::Pass *_pass{nullptr};
// weak reference
gfx::Device *_device{nullptr};
};
} // namespace pipeline