Bug 496698 - kwin_wayland memory leak
Summary: kwin_wayland memory leak
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: performance (show other bugs)
Version: 6.2.3
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-26 10:44 UTC by Evert Vorster
Modified: 2024-12-13 04:33 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evert Vorster 2024-11-26 10:44:54 UTC
SUMMARY
kwin_wayland is using a LOT of memory. 
My system as an uptime of only 27 minutes, and kwin_wayland has VIRT 20.0G RAM, and RES 17.3G of RAM. 
This is a little excessive, no?

STEPS TO REPRODUCE
1. Log in to a KDE Wayland session


OBSERVED RESULT
kwin_wayland process is consuming huge amounts of RAM.

EXPECTED RESULT
kwin_wayland to not consume such a lot of RAM. 

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.11.5-arch1-1.1-g14 (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 7945HX3D with Radeon Graphics
Memory: 62.0 GiB of RAM
Graphics Processor: AMD Radeon 610M
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: ROG Strix G733PYV_G733PYV
System Version: 1.0

ADDITIONAL INFORMATION
The laptop is an Advanced Optimus type laptop, with secondary GPU an nVidia 4090. 
Plugged into the HDMI port of the laptop is a BenQ EX3210U 4K monitor, running at 120fps. 

Been running firedragon-bin and google-chrome for a bit, no other applications, apart from a few dosbox-x sessions that were not too long lived.
Comment 1 Evert Vorster 2024-11-26 15:11:37 UTC
Digging a little deeper here, it looks like kwin_wayland has a pretty serious memory leak. 
Running kwin_x11 as a comparison, memory consumption stayed pretty low, less than 1Gb. 

When starting a new session of kwin_wayland, memory usage is initially pretty low, but then grows steadily over time. 

To pass the time, I was watching some youtube videos on Google-chrome, and had console open with a session of glances to monitor the memory usage of kwin_wayland. 

It seems to be growing in memory consumption at a rate of just less than 2Gb per minute.
Comment 2 Nate Graham 2024-11-26 17:05:55 UTC
Are you using any 3rd-party KWin scripts, effects, or window decorations?

Does it reproduce in a new clean user account on the same machine?
Comment 3 Evert Vorster 2024-11-27 09:15:58 UTC
Hi there!

My KDE desktop is pretty vanilla, with no custom scripts. 

However, I made a new user and tested with that, and there was no memory leak, with kwin_wayland only using 460Mb after about ten minutes. I did a little browsing on google-chrome and firedragon to pass time, and of course had a console open to monitor the memory usage of kwin_wayland. 

I am currently back on my normal user, and right now kwin_wayland does not seem to be displaying the same behavior. It seems a bit weird, but I will monitor it for a bit, and see if this is really gone.
Comment 4 Evert Vorster 2024-11-28 08:23:10 UTC
OK, so the problem seems to be intermittent. Right now I have updated to plasma 6.2.4. 
Running as my normal user. I can see that kwin_wayland is growing in memory size by about 1Gb per minute. 
For the record, my external monitor is now plugged into the HDMI port on my laptop. 

Previously, when it was plugged into the USB-C laptop dock, I did not see this issue. I will do some A-B testing to make sure if this is relevant.
Comment 5 Evert Vorster 2024-11-28 08:30:41 UTC
OK, confirmed it. 

In one session, when the external monitor is plugged into the HDMI port of the laptop, its memory usage grows by about 1Gb/min. 

Unplugging it from the HDMI port of the laptop, the memory usage falls to it's usual ~400mb. 
Plugging the monitor into the HDMI port of the USB-C laptop dock, memory usage stays constant. 

Plugging it back into the HDMI port of the laptop, the memory leak starts up again. Hope this helps.
Comment 6 Bug Janitor Service 2024-12-13 03:46:42 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 7 Evert Vorster 2024-12-13 04:32:52 UTC
I have not seen this bug in a while. It may just have been a transient bug.