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
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>
(cherry picked from commit eeda4ac4d2)
This commit is contained in:
Tomi Korpipaa 2024-02-27 14:07:34 +02:00
parent 330b2f98c9
commit 84d71a09a2
2 changed files with 5 additions and 0 deletions

View File

@ -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;

View File

@ -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";