Bug 462202 - Massive VRAM leak when using tab switcher visualization with kwin_x11
Summary: Massive VRAM leak when using tab switcher visualization with kwin_x11
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: tabbox (show other bugs)
Version: 5.26.3
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-24 15:10 UTC by Wladimir Palant
Modified: 2023-01-02 09:41 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Minimized problematic source code (1.81 KB, application/zip)
2022-11-24 15:10 UTC, Wladimir Palant
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wladimir Palant 2022-11-24 15:10:36 UTC
Created attachment 153993 [details]
Minimized problematic source code

This is a spin-off from bug 455193, just in case the root issue is a different one.

STEPS TO REPRODUCE

1. Open top in a console
2. Select “Grid” as your tab switcher visualization (other visualizations create smaller windows, resulting in a smaller leak)
3. Press Alt-Tab a bunch of times

OBSERVED RESULT

Each time the tab switcher visualization shows up, top shows “buff/cache” value go up by ~40 MB, “avail Mem” value goes down by the same amount. /proc/sys/vm/drop_caches has no effect. Eventually the entire RAM gets filled up and the system becomes unresponsive.

Restarting kwin_x11 releases all the memory hoarded here.

As indicated in bug 455193, disabling composition by means of QT_XCB_GL_INTEGRATION=xcb_egl makes this leak go away.

EXPECTED RESULT

Memory usage should stay stable.

SOFTWARE/OS VERSIONS
Linux: Fedora Linux 37 (didn’t happen with Fedora 36)
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
CPU: Intel i7-1165G7 (built-in graphics used, Nvidia GeForce present but inactive)

ADDITIONAL INFORMATION
I took the source code of tabboxhandler.cpp and produced a reduced test case. The leak is caused by the mere act of showing a PlasmaCore.Dialog via QML. So the root issue is likely not in KDE but I didn’t manage to narrow it down further so far.

Unpack the attached source code to a directory. Run the following command to compile (qt5-qtdeclarative-devel package required):

cmake . && make

It will produce an executable called test. When you run it, it will show an empty dialog window and hide it again repeatedly. Each such cycle leaks close to 100 MB of memory, similarly to how task switcher visualization would do it. As with the task switcher visualization, the way to get this memory back is restarting kwin_x11 (killing the application is not sufficient).
Comment 1 Manuel Bärenz 2022-12-19 15:10:27 UTC
I believe I'm encountering the same issue.

OpenGL renderer string:                 RENOIR (renoir, LLVM 14.0.6, DRM 3.42, 5.15.76)
Driver:                                 RadeonSI
GPU class:                              Vega
OpenGL version:                         4.6
GLSL version:                           4.60
Mesa version:                           22.2.2
X server version:                       1.20.14
Linux kernel version:                   5.15.76
KDE-Plasma-Version: 5.26.2
KDE-Frameworks-Version:5.99.0
Qt-Version: 5.15.7
Comment 2 Wladimir Palant 2022-12-24 18:14:12 UTC
It seems that this is no longer happening. Not sure which update fixed it, but the issue is gone.
Comment 3 Manuel Bärenz 2023-01-01 13:05:51 UTC
(In reply to Wladimir Palant from comment #2)
> It seems that this is no longer happening. Not sure which update fixed it,
> but the issue is gone.

Which version of KDE and Mesa are you using?
Comment 4 Wladimir Palant 2023-01-02 08:10:01 UTC
Operating System: Fedora Linux 37
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7
Kernel Version: 6.0.10-300.fc37.x86_64 (64-bit)
Graphics Platform: X11
Mesa Version: 22.3.1
Comment 5 Manuel Bärenz 2023-01-02 09:41:35 UTC
Then probably mesa 22.2 -> 22.3 resolved the issue just as in https://bugs.kde.org/show_bug.cgi?id=457847?