-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.7.3, 6.9.1
-
None
-
-
5860933a6 (dev), dc73b80e2 (6.10), 35bf60eff (6.9), 7b84ec75c (tqtc/lts-6.8)
updating a QRhiBuffer via QRhiResourceUpdateBatch::updateDynamicBuffer
std::unique_ptr<QRhiBuffer> buffer(rhi->newBuffer(QRhiBuffer::Dynamic, QRhiBuffer::UniformBuffer, 1024)); for (int k = 0; k < 10000000; k++) { auto ru = renderer.resourceUpdateBatch(); for (int i = 0; i < 10; i++) { ru->updateDynamicBuffer(buffer.get(), 0, sizeof(int), &i); ru->updateDynamicBuffer(buffer.get(), 256, sizeof(int), &i); ru->updateDynamicBuffer(buffer.get(), 512, sizeof(int), &i); } renderer.enqueueResourceUpdateBatch(); }
and then submitting these updates via `beginOffscreenFrame`
void Renderer::enqueueResourceUpdateBatch() { QRhiCommandBuffer* cb; rhi->beginOffscreenFrame(&cb); cb->resourceUpdate(m_currentResourceUpdateBatch); rhi->endOffscreenFrame(); }
Leads to a memory leak.
The problem seems to come from `QRhiResourceUpdateBatchPrivate::BufferOp::changeToDynamicUpdate` which call `op->data.assign` where `d->ref == 3`. I don't know what is keep some refs which cause this memory leak !
For Gerrit Dashboard: QTBUG-138861 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
665319,2 | rhi: d3d12: Reset command allocator for offscreen frames | dev | qt/qtbase | Status: MERGED | +2 | +1 |
667809,2 | rhi: d3d12: Reset command allocator for offscreen frames | 6.10 | qt/qtbase | Status: MERGED | +2 | 0 |
667838,2 | rhi: d3d12: Reset command allocator for offscreen frames | 6.9 | qt/qtbase | Status: MERGED | +2 | 0 |
667983,2 | rhi: d3d12: Reset command allocator for offscreen frames | tqtc/lts-6.8 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |