| Summary: | KDE / KWin slowly eats (leaks?) my graphics memory (GART) until it begins stuttering | ||
|---|---|---|---|
| Product: | [Plasma] kwin | Reporter: | Adam Fontenot <adam.m.fontenot+kde> |
| Component: | wayland-generic | Assignee: | KWin default assignee <kwin-bugs-null> |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | major | CC: | kde, nate, vlad.zahorodnii, xaver.hugl |
| Priority: | NOR | Keywords: | qt6 |
| Version First Reported In: | 5.93.0 | ||
| Target Milestone: | --- | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Adam Fontenot
2024-02-03 19:28:20 UTC
I'm over 2 days into an X11 session now, and it is *very* clear already that the issue doesn't affect X11. I've played videos, games, used the browser heavily, and so on, and right now (as I type this into the browser) my GPU is using only 461 MB of GART memory. I would greatly appreciate anyone with a recent AMD laptop trying to reproduce this. As things stand, the KDE Wayland session isn't really usable for me unless I shut down my computer every day. It simply uses too much RAM. I expect many others will have this issue too, although it's not the easiest to isolate the cause and these issues might not get reported. Can you check what exactly triggers kwin to leak memory? maybe toggling overview or task switcher? or does memory continuously leak without doing anything? I'm switching back to Wayland since I think I can confirm it's specific to that. It tends to slowly grow over time, so it's hard to pinpoint. The biggest thing I've noticed so far is that putting the computer to sleep and waking it up again (and unlocking the lock screen) tends to create a temporary jump, and some of this seems to be "sticky". Unfortunately this is pretty variable. Sometimes no more than 10 MB or so sticks around, sometimes (like right now as I write this comment, as a test), it goes from 350 MB used to 1100 MB used, and even after waiting for it to subside for a few minutes, it's stuck at 800 MB. So that's a 450 MB jump in memory usage by the graphics system in less than a minute. For clarity and emphasis, this didn't happen under the KDE X11 session in my testing. After 2+ days of use, with a browser running, only 461 MB of GART memory was consumed by graphics. One additional thing I've noticed, which may indicate that suspend is a red herring here: If you fill up both the entire VRAM (1 GB) and some amount of GART (e.g. 1 GB) - I did this by running several games at once - and then suspend the system while the games are still running, when the system is resumed the VRAM value will be <= 100 MB and GART will have increased by the difference. The exact significance of this isn't clear to me, but it may indicate that the KDE leak is happening in VRAM. I think I need to be tracking both the VRAM and GART usage - probably a sustained increase in the sum of the two reflects a leak. I haven't seen this happen on my AMD laptop. Can you still reproduce this with the released Plasma 6? I haven't see the issue recur, so I'm going to close this for now. I'll reopen this if it happens again. Some notes for others who may have encountered similar issues: * The issue began for me either after Plasma 6 beta 1 or beta 2 was installed. It was clearly present continuously for some time - even before I diagnosed the issue, any time Plasma had been running for more than a few days I would encounter performance issues. * The Plasma 6 Wayland session still uses quite a bit more graphics memory than Xorg, and this amount grows over time. Recently (since I stopped being able to reproduce the bug), I see 2-3 GB of graphics memory held under Wayland after about a week of use, vs ~0.5 GB for Xorg. But I haven't seen 50+% utilization of GART since I reported the issue. * The way you'd confirm you have the issue on an AMD system is, (a) you see a lot of memory use that is not attributable to applications, cache, or ZFS ARC, (b) the memory is not automatically reclaimed when you start an application that uses a lot of memory - it crashes or you get an OOM condition, and (c) running `radeontop` shows 90+% utilization of "GTT" memory, (d) closing all userspace applications doesn't reduce it significantly, and (e) closing your Plasma session and returning to a VTERM immediately reduces GART / GTT usage to ~0%. |