Reduce the amount of leaked memory

This patch adds calling releaseResources() to the
QQuickWindow each time series visuals change. It appears
some resources are not released even though deleteLater() has been
called for them. The patch drops the memory consumption
increase significantly (3.75-fold in the test app from the ticket
when in Legacy mode).

Some memory consumption increase is still observed, so the ticket
should not be closed. However, priority can be dropped a bit.

Task-number: QTBUG-113199
Pick-to: 6.6
Change-Id: I79582e64c52c001d43550ed2f8f67bcaec0c42fc
Reviewed-by: Sami Varanka <sami.varanka@qt.io>
Reviewed-by: Sakaria Pouke <sakaria.pouke@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Dilek Akcay <dilek.akcay@qt.io>
(cherry picked from commit f83d157fd5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tomi Korpipaa 2024-02-27 14:07:34 +02:00 committed by Qt Cherry-pick Bot
parent 7668911548
commit eeda4ac4d2
2 changed files with 6 additions and 0 deletions

View File

@ -1508,6 +1508,9 @@ void QQuickGraphsBars::updateBarVisuals(QBar3DSeries *series)
QLinearGradient gradient = series->baseGradient();
if (optimizationHint() == QAbstract3DGraph::OptimizationHint::Legacy) {
// Release resources that might not have been deleted even though deleteLater had been set
window()->releaseResources();
for (int i = 0; i < barList.count(); i++) {
QQuick3DModel *model = barList.at(i)->model;
auto textureData = static_cast<QQuickGraphsTextureData *>(

View File

@ -269,6 +269,9 @@ void QQuickGraphsScatter::updateScatterGraphItemVisuals(ScatterModel *graphModel
: false;
if (optimizationHint() == QAbstract3DGraph::OptimizationHint::Legacy) {
// Release resources that might not have been deleted even though deleteLater had been set
window()->releaseResources();
if (itemCount != graphModel->dataItems.size())
qWarning() << __func__ << "Item count differs from itemList count";