diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2024-02-27 14:07:34 +0200 |
---|---|---|
committer | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2024-03-12 10:23:48 +0200 |
commit | 84d71a09a24ec304b4c7405916be3a095ba2e1c8 (patch) | |
tree | 6aa84dc32d880a2c5272a23d9eb782dbcca8ce57 | |
parent | 330b2f98c95bc84363e3da437b7af06bac26c161 (diff) |
Reduce the amount of leaked memory6.6
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
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 f83d157fd541350dd4e06e7fac195363f103db0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit eeda4ac4d2d1b194325eb70b5eb1e55a92ecf779)
-rw-r--r-- | src/graphs/qml/qquickgraphsbars.cpp | 3 | ||||
-rw-r--r-- | src/graphs/qml/qquickgraphsscatter.cpp | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/graphs/qml/qquickgraphsbars.cpp b/src/graphs/qml/qquickgraphsbars.cpp index c6a1cc2..562f8af 100644 --- a/src/graphs/qml/qquickgraphsbars.cpp +++ b/src/graphs/qml/qquickgraphsbars.cpp @@ -1129,6 +1129,9 @@ void QQuickGraphsBars::updateBarVisuals(QBar3DSeries *series) QColor barColor; if (m_barsController->optimizationHints() == QAbstract3DGraph::OptimizationLegacy) { + // Release resources that might not have been deleted even though deleteLater had been set + window()->releaseResources(); + if (!rangeGradient) { for (int i = 0; i < barList.count(); i++) { QQuick3DModel *model = barList.at(i)->model; diff --git a/src/graphs/qml/qquickgraphsscatter.cpp b/src/graphs/qml/qquickgraphsscatter.cpp index 356f3ab..4f62c3f 100644 --- a/src/graphs/qml/qquickgraphsscatter.cpp +++ b/src/graphs/qml/qquickgraphsscatter.cpp @@ -233,6 +233,8 @@ void QQuickGraphsScatter::updateScatterGraphItemVisuals(ScatterModel *graphModel == Q3DTheme::ColorStyleRangeGradient) ? true : false; if (m_scatterController->optimizationHints() == QAbstract3DGraph::OptimizationLegacy) { + // 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"; |