Bug 454590 - wayland amd memleak
Summary: wayland amd memleak
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.24.5
Platform: Slackware Linux
: NOR major
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
: 455625 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-05-30 01:10 UTC by Allan Pedersen
Modified: 2022-08-18 03:21 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
heaptrack screenshot (340.13 KB, image/png)
2022-05-30 01:10 UTC, Allan Pedersen
Details
heaptrack log memleak (2.58 MB, application/zstd)
2022-05-30 01:29 UTC, Allan Pedersen
Details
heaptrak of leak before dtor patch (3.39 MB, application/zstd)
2022-06-20 00:48 UTC, Allan Pedersen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Allan Pedersen 2022-05-30 01:10:10 UTC
Created attachment 149323 [details]
heaptrack screenshot

SUMMARY
***
I noticed plasmashell was, apparently, using more than 20 gigabytes of memory. I did a heaptrack capture for five minutes. In that time plasmashell allocated another 1.3 gigabytes. I've attached a heaptrack screenshot and will attempt to attach the log aswell.
***


STEPS TO REPRODUCE
1. I've yet to consistently reproduce it. It happens from time to time.

OBSERVED RESULT
Plasmashell using all available memory and the system starts to swap.

EXPECTED RESULT
Plasmashell using less than 150 megabytes of memory.

SOFTWARE/OS VERSIONS
Linux: 5.15.38
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
I'm running plasma wayland with an AMD RX570 and not sure whether culprit is plasmashell, qt, mesa or amdgpu because the following shows up, alot, in wayland-session log:

"...
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
kwin_libinput: Libinput: client bug: timer event15 debounce short: scheduled expiry is in the past (-12ms), your system is too slow

mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
kf.plasma.quick: Couldn't create KWindowShadow for Osd_QMLTYPE_942(0x3a9d110)
kf.plasma.quick: Couldn't create KWindowShadow for Osd_QMLTYPE_942(0x3a9d110)
..."
Comment 1 Allan Pedersen 2022-05-30 01:29:01 UTC
Created attachment 149324 [details]
heaptrack log memleak
Comment 2 Méven Car 2022-06-01 06:42:33 UTC
Thank you for the trace, that is helpful.

It does not have all the relevant debug symbols though.
Those for kguiaddons in this case in particular would enrich the trace substantially.
Comment 3 Bug Janitor Service 2022-06-01 06:49:29 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kguiaddons/-/merge_requests/59
Comment 4 Méven Car 2022-06-01 07:11:21 UTC
(In reply to Méven Car from comment #2)
> Thank you for the trace, that is helpful.
> 
> It does not have all the relevant debug symbols though.

That's not true, it is just I don't have the exact same debug symbols as you do, since I compile everything myself.
Comment 5 Méven Car 2022-06-01 17:11:47 UTC
Git commit 04ddcecb5c91a79bce7443e2c43ed93450f435b1 by Méven Car.
Committed on 01/06/2022 at 17:08.
Pushed by meven into branch 'master'.

WaylandClipboard: DataControlSource: delete m_mimeData in dtor

As QClipboard::setMimeData in comments notes it passes ownership of the pointer.

M  +1    -0    src/systemclipboard/waylandclipboard.cpp

https://invent.kde.org/frameworks/kguiaddons/commit/04ddcecb5c91a79bce7443e2c43ed93450f435b1
Comment 6 Allan Pedersen 2022-06-20 00:43:56 UTC
With the patch
https://invent.kde.org/frameworks/kguiaddons/-/commit/04ddcecb5c91a79bce7443e2c43ed93450f435b1
applied there still seems to be a leak in plasma_engine_clipboard.

I will attempt to attach a new heaptrack.
Comment 7 Allan Pedersen 2022-06-20 00:48:59 UTC
Created attachment 149937 [details]
heaptrak of leak before dtor patch
Comment 8 Allan Pedersen 2022-06-20 01:07:55 UTC
(In reply to Allan Pedersen from comment #7)
> Created attachment 149937 [details]
> heaptrak of leak before dtor patch

I made an error and didn't apply the patch correctly.
Comment 9 Fushan Wen 2022-06-20 01:59:07 UTC
*** Bug 455625 has been marked as a duplicate of this bug. ***