SUMMARY If we repeatedly open the activity manager sidebar (the one that shows a list of activities and allows you to suspend or resume them) Plasma's memory usage increases without bound. The consumed memory does not seem to be freed even 30 minutes later. This is also reproducible by repeatedly opening and closing popups in the system tray. STEPS TO REPRODUCE 1. Open a Konsole window (to run the script) and a Ksysguard window (to monitor Plasma's memory usage) 2. Note the initial memory usage of the plasmashell process. 3. Run the following script in bash: ``` while true do sleep 0.1 qdbus org.kde.plasmashell /PlasmaShell toggleActivityManager done ``` OBSERVED RESULT Note that the memory keeps on increasing without bound. After perhaps 10 minutes, the memory usage is a few 100 MB greater than the initial value (I have observed it easily crossing 500 MB). If you kill the script, wait, and look at Plasma's memory usage after some time, you will still see that it is >= the value it had when you killed the script. EXPECTED RESULT Memory usage should not increase without bound. Even if it increases, it should at least be freed after some time. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 5.19.0 KDE Frameworks Version: 5.70.0 Qt Version: 5.15.0 Kernel Version: 5.6.15-arch1-1 Display server: X Compositor rendering backend: Opengl 2.0 Graphics driver: amdgpu HARDWARE INFORMATION OS Type: 64-bit Processors: 8 × AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx Memory: 13.6 GiB of RAM Graphics Processor: AMD RAVEN ADDITIONAL INFORMATION I often observe that after a week or so of uptime, plasmashell's memory usage can be close to a GB, which may be due to the same underlying cause. You can also reproduce this same issue by repeatedly clicking on system tray applets for many minutes, but I have reported for the activities manager as is was the first thing I was able to figure out how to activate from a script. I was also able to reproduce this in a different user account with the default theme, window decorations, etc. POSSIBLE DUPLICATES bug 412865 bug 393929
I'm able to reproduce this on Fedora 32 with Plasma 5.18.5, Frameworks 5.70.0 and Qt 5.14.2
I should add that I'm also on an X11 session on amdgpu, but I could still reproduce this with the compositor toggled off (alt+shift+f12).
I can reproduce this in a Wayland session as well. In X11, setting `export QSG_RENDER_LOOP="basic"` in `~/.xprofile` (suggested on some other reports of memory leaks) does not help.
Created attachment 136910 [details] Output of valgrind on repeadtedly triggering the activity manager sidebar Hi, I am attaching the valgrind output from a run of plasmashell. On opening it in Massif-Visualizer, I can see a linear growth of heap memory under `QObjectPrivate::connectImpl(QObject const*, int, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) (qobject.cpp:5050)`. Hopefully this is useful to find out the root cause of this bug. Here are the steps I used to generate this file: ``` kquitapp5 plasmashell #Kill already running plasmashell valgrind --tool=massif plasmashell #Do stuff to trigger the memory leak (run the script in my report for a while or just click around on various widgets) kquitapp5 plasmashell #Kill plasmashell after some time. ``` In case you want me to compile any other packages with debug symbols or pass any other options to valgrind, please let me know.
Here is the heaptrack output (64MB file; I didn't pass any special options to heaptrack), after repeatedly opening the activity manager for about 20 min. It shows a huge leak in "QImageData::create". Not sure how helpful this is. https://drive.google.com/file/d/14qCFKkS8L8Own7NVCbOiXSN3Ji_VLitx/view?usp=sharing
In Plasma 5.21.4, Qt 5.15.2, Frameworks 5.80, on a Wayland session in Fedora 34, I can successfully reproduce this leak with that bash script. Maybe this is a Qt bug, not sure, but since it does occur, I'll mark it as confirmed.
I cannot reproduce this on two different computers: Desktop PC Operating System: Arch Linux KDE Plasma Version: 5.23.1 KDE Frameworks Version: 5.87.0 Qt Version: 5.15.2 Kernel Version: 5.14.14-arch1-1 (64-bit) Graphics Platform: X11 Processors: 8 × Intel® Core™ i7-4790K CPU @ 4.00GHz Memory: 15.5 GiB of RAM Graphics Processor: NVIDIA GeForce GTX 1070/PCIe/SSE2 Laptop Operating System: Arch Linux KDE Plasma Version: 5.23.1 KDE Frameworks Version: 5.87.0 Qt Version: 5.15.2 Kernel Version: 5.14.14-arch1-1 (64-bit) Graphics Platform: X11 Processors: 8 × 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz Memory: 15.4 GiB of RAM Graphics Processor: Mesa Intel® Xe Graphics
I cannot reproduce it in an X11 session on amdgpu either. Could be a driver bug. Can the bug still be reproduced today?
I can still reproduce this bug on Plasma 5.23.3, Fedora 35. Maybe this is Wayland-exclusive. I will give this the wayland keyword.
I can reproduce this on X11 (this is in a VM; will test on my main machine tomorrow): Operating System: Arch Linux KDE Plasma Version: 5.23.4 KDE Frameworks Version: 5.88.0 Qt Version: 5.15.2 Kernel Version: 5.10.83-1-lts (64-bit) Graphics Platform: X11 Processors: 4 × AMD EPYC-Rome Processor Memory: 1.4 GiB of RAM Graphics Processor: virgl
I can still reproduce this on a machine that uses amdgpu. Plasmashell's memory consumption went from 150 MB to 650 MB in 40 minutes when I left the loop from the initial comment running. Operating System: Arch Linux KDE Plasma Version: 5.23.4 KDE Frameworks Version: 5.88.0 Qt Version: 5.15.2 Kernel Version: 5.15.6-arch2-1 (64-bit) Graphics Platform: X11 Processors: 8 × AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx Memory: 21.5 GiB of RAM Graphics Processor: AMD Radeon Vega 8 Graphics