Bug 465441 - plasmashell leaks memory after each resume (currently around 23 GB) [with heaptrack] in plasmadesktoptheme.cpp:231
Summary: plasmashell leaks memory after each resume (currently around 23 GB) [with hea...
Status: REPORTED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-performance (show other bugs)
Version: 5.26.5
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-07 19:28 UTC by Szőts Ákos
Modified: 2023-10-17 08:28 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
23 GB leak (7.95 KB, image/png)
2023-02-07 19:28 UTC, Szőts Ákos
Details
Flame graph (253.89 KB, image/png)
2023-02-07 19:28 UTC, Szőts Ákos
Details
Top leakers (77.36 KB, image/png)
2023-02-07 19:29 UTC, Szőts Ákos
Details
Top-down (310.85 KB, image/png)
2023-02-07 19:29 UTC, Szőts Ákos
Details
30 GB Plasma leak (5.59 KB, image/png)
2023-07-07 19:22 UTC, Szőts Ákos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Szőts Ákos 2023-02-07 19:28:29 UTC
Created attachment 156038 [details]
23 GB leak

Plasmashell, after 3-4 sleep resume cycles, starts leaking memory. In the first 3-4 cycles just some hundred MBs but then after +5 GB, then +15 GB.

Heaptrack shows the following backtrace as one of the culprits:

main in plasmashell
QCoreApplication::exec() in libQt5Core.so.5
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) in libQt5Core.so.5
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) in libQt5Core.so.5
g_main_context_iteration in libglib-2.0.so.0
g_main_context_iterate in libglib-2.0.so.0
g_main_context_dispatch in libglib-2.0.so.0
g_main_dispatch in libglib-2.0.so.0
postEventSourceDispatch in libQt5Core.so.5
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) in libQt5Core.so.5
QCoreApplication::notifyInternal2(QObject*, QEvent*) in libQt5Core.so.5
QApplicationPrivate::notify_helper(QObject*, QEvent*) in libQt5Widgets.so.5
QObject::event(QEvent*) in libQt5Core.so.5
PlasmaDesktopTheme::syncWindow() in org.kde.desktop.so
QMetaObject::Connection QObject::connect<void (QQuickWindow::*)(), void (PlasmaDesktopTheme::*)()>(QtPrivate::FunctionPointer<void (QQuickWindow::*)()>::Object const*, void (QQuickWindow::*)(), QtPrivate::FunctionPointer<void (PlasmaDesktopTheme::*)()>::Object const*, void (PlasmaDesktopTheme::*)(), Qt::ConnectionType) in org.kde.desktop.so
QObject::connectImpl(QObject const*, void**, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) in libQt5Core.so.5
QObjectPrivate::connectImpl(QObject const*, int, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) in libQt5Core.so.5

According to it, the leaking line is plasmadesktoptheme.cpp:231:

if (qw) {
    connect(qw, &QQuickWindow::sceneGraphInitialized, this, &PlasmaDesktopTheme::syncWindow);
}

Heaptrack file: https://mega.nz/file/lRJFmSCC#olTMN_Kqf8Cv1l2OlKDzZ_lYoQSWkSisL2JGQ_z7j3I

Please, take a look whether you can find other problems, too. Thank you!

Operating System: openSUSE Tumbleweed 20230130
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8
Kernel Version: 6.1.8-1-default (64-bit)
Graphics Platform: X11
Memory: 78.5 GiB of RAM
Comment 1 Szőts Ákos 2023-02-07 19:28:57 UTC
Created attachment 156039 [details]
Flame graph
Comment 2 Szőts Ákos 2023-02-07 19:29:09 UTC
Created attachment 156040 [details]
Top leakers
Comment 3 Szőts Ákos 2023-02-07 19:29:19 UTC
Created attachment 156041 [details]
Top-down
Comment 4 Sebastian 2023-06-10 10:54:25 UTC
This sounds like exactly the issue I am experiencing as well, except that it only starts occuring after about 20 sleep/resume cycles. 

I have the impression the leak is exponential though, the first few cycles the memory increases as well, but barely noticeable (<50 MB), then after about 20 cycles it increases to 1 GB, then each cycle to 1.5 / 2.5 / 4.3 / 8.0 GB. 

It does not seem to matter how much time passed between sleep and resume.

heaptrack does not seem to show anything out of the ordinary, but I am probably not reading it right.

My system:
Operating System: Ubuntu Studio 22.04
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.19.0-1024-lowlatency (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 1600X Six-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3060/PCIe/SSE2
Comment 5 Szőts Ákos 2023-07-07 19:22:19 UTC
Created attachment 160131 [details]
30 GB Plasma leak

Just wanted to confirm that in the latest version it's still an issue.

Operating System: openSUSE Tumbleweed 20230603
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9
Kernel Version: 6.3.4-1-default (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor