<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>518939</bug_id>
          
          <creation_ts>2026-04-14 00:18:32 +0000</creation_ts>
          <short_desc>Extreme memory leak with &quot;No Titlebar and Frame&quot; (No) with Wayland and Firefox</short_desc>
          <delta_ts>2026-07-27 15:04:04 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>rules</component>
          <version>6.6.4</version>
          <rep_platform>Neon</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>crash</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ken Vermette">vermette</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          <cc>gyges</cc>
    
    <cc>isma.af</cc>
    
    <cc>nate</cc>
    
    <cc>xaver.hugl</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/kwin/-/commit/4d3e2c5bddd2e266e82e2d87c09c71d0908198ac</cf_commitlink>
          <cf_versionfixedin>6.6.6</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2509937</commentid>
    <comment_count>0</comment_count>
    <who name="Ken Vermette">vermette</who>
    <bug_when>2026-04-14 00:18:32 +0000</bug_when>
    <thetext>SUMMARY
When using Mozilla Firefox (Env var MOZ_ENABLE_WAYLAND=1) on Wayland, setting the window rule &quot;No Titlebar and Frame&quot; causes the kwin_wayland process to leak substantial memory, reaching multiple gigabytes in minutes, rapidly destabilizing the system and eventually causing a crash.

Other applications (E.g. Chrome and VSCode) do not trigger this effect when identically configured. Only Firefox exhibits this issue. I would report this to Mozilla, but it&apos;s the kwin_wayland process that&apos;s inflating, looks like a safeguard is needed.

Reason for applying this effect: This - combined with &quot;Hide Titlebar&quot; in the Breeze deco will force CSD-driven applications to use the systems native frame, even rounding bottom corners reliably!

STEPS TO REPRODUCE
1. Open Mozilla Firefox
2. Open Window Rules
3. Create a new window rule targeting Firefox.
4. Add &quot;No Titlebar and Frame&quot;, and set it to &quot;No&quot;. You may either &quot;Force&quot; apply it, or set it to &quot;Apply Initially&quot; and restart Firefox.

OBSERVED RESULT
After a few seconds, the kwin_wayland process will begin rapidly consuming RAM until KWin destabilizes and crashes.
If Firefox is closed, memory usage stabilizes. If re-opened, it begins climbing again.

EXPECTED RESULT
kwin_wayland will maintain usual RAM usage.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon
KDE Plasma Version: 6.6.1 - 6.6.4 (multiple machines)
KDE Frameworks Version: 6.24.0
Qt Version: 6.10.2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2510247</commentid>
    <comment_count>1</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2026-04-15 22:57:15 +0000</bug_when>
    <thetext>I only tested this on git master, but I didn&apos;t see any excessive amount of memory usage. KWin did use a lot of CPU while in this configuration though, maybe 6.6 has a leak in the code path we&apos;re clearly going into a lot with this configuration.

I took a quick look with hotspot, and it seems that Firefox requests the CSD mode every time KWin sends the event that it&apos;s actually rendering SSD. It looks like we&apos;re doing a lot of work in KWin when the client requests a decoration mode that we ignore anyways... or even if we honor it and the client has already requested the same mode before.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2511042</commentid>
    <comment_count>2</comment_count>
    <who name="Ken Vermette">vermette</who>
    <bug_when>2026-04-20 16:35:01 +0000</bug_when>
    <thetext>(In reply to Zamundaaa from comment #1)
&gt; I only tested this on git master, but I didn&apos;t see any excessive amount of
&gt; memory usage. KWin did use a lot of CPU while in this configuration though,
&gt; maybe 6.6 has a leak in the code path we&apos;re clearly going into a lot with
&gt; this configuration.
&gt; 
&gt; I took a quick look with hotspot, and it seems that Firefox requests the CSD
&gt; mode every time KWin sends the event that it&apos;s actually rendering SSD. It
&gt; looks like we&apos;re doing a lot of work in KWin when the client requests a
&gt; decoration mode that we ignore anyways... or even if we honor it and the
&gt; client has already requested the same mode before.

Worth noting is that both machines are running Nvidia GPUs, so perhaps a driver complication?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2523618</commentid>
    <comment_count>3</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2026-06-16 21:54:01 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/9402</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2523782</commentid>
    <comment_count>4</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2026-06-17 12:25:21 +0000</bug_when>
    <thetext>Git commit 17b18492762d722906e4d5b3c434af2dfce14a38 by Xaver Hugl.
Committed on 17/06/2026 at 11:30.
Pushed by zamundaaa into branch &apos;master&apos;.

wayland/xdgdecoration: ignore irrelevant preferred mode changes

Some clients (Firefox) request the preferred mode for some reason if it&apos;s not
honored by the compositor, which makes KWin send another configure event, which
makes the client send another request, infinitely in a loop.

While Firefox shouldn&apos;t do that, KWin should also not do a bunch of additional
work for no reason.

M  +3    -0    src/wayland/server_decoration.cpp
M  +8    -3    src/wayland/xdgdecoration_v1.cpp

https://invent.kde.org/plasma/kwin/-/commit/17b18492762d722906e4d5b3c434af2dfce14a38</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2523827</commentid>
    <comment_count>5</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2026-06-17 13:33:04 +0000</bug_when>
    <thetext>Git commit cec7616c36f9e4977c7b5e0d16b12c752071a73b by Xaver Hugl.
Committed on 17/06/2026 at 12:32.
Pushed by zamundaaa into branch &apos;Plasma/6.7&apos;.

wayland/xdgdecoration: ignore irrelevant preferred mode changes

Some clients (Firefox) request the preferred mode for some reason if it&apos;s not
honored by the compositor, which makes KWin send another configure event, which
makes the client send another request, infinitely in a loop.

While Firefox shouldn&apos;t do that, KWin should also not do a bunch of additional
work for no reason.


(cherry picked from commit 17b18492762d722906e4d5b3c434af2dfce14a38)

Co-authored-by: Xaver Hugl &lt;xaver.hugl@kde.org&gt;

M  +3    -0    src/wayland/server_decoration.cpp
M  +8    -3    src/wayland/xdgdecoration_v1.cpp

https://invent.kde.org/plasma/kwin/-/commit/cec7616c36f9e4977c7b5e0d16b12c752071a73b</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2523842</commentid>
    <comment_count>6</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2026-06-17 14:07:38 +0000</bug_when>
    <thetext>Git commit 4d3e2c5bddd2e266e82e2d87c09c71d0908198ac by Xaver Hugl.
Committed on 17/06/2026 at 12:32.
Pushed by zamundaaa into branch &apos;Plasma/6.6&apos;.

wayland/xdgdecoration: ignore irrelevant preferred mode changes

Some clients (Firefox) request the preferred mode for some reason if it&apos;s not
honored by the compositor, which makes KWin send another configure event, which
makes the client send another request, infinitely in a loop.

While Firefox shouldn&apos;t do that, KWin should also not do a bunch of additional
work for no reason.


(cherry picked from commit 17b18492762d722906e4d5b3c434af2dfce14a38)

Co-authored-by: Xaver Hugl &lt;xaver.hugl@kde.org&gt;

M  +3    -0    src/wayland/server_decoration.cpp
M  +8    -3    src/wayland/xdgdecoration_v1.cpp

https://invent.kde.org/plasma/kwin/-/commit/4d3e2c5bddd2e266e82e2d87c09c71d0908198ac</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2525471</commentid>
    <comment_count>7</comment_count>
    <who name="">gyges</who>
    <bug_when>2026-06-22 00:40:42 +0000</bug_when>
    <thetext>What a nasty bug to catch … well done!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2525475</commentid>
    <comment_count>8</comment_count>
    <who name="">gyges</who>
    <bug_when>2026-06-22 00:55:33 +0000</bug_when>
    <thetext>(In reply to gyges from comment #7)
&gt; What a nasty bug to catch … well done!

Yet, there might be another source of memory leakage.

I&apos;m using a &quot;merger&quot; of titlebar and tabbar as well (titlebar deactivated, tabs and window controls in *one single bar*) and the memory leakage of Firefox on Plasma was not funny, yet it was not &quot;fatal&quot; and didn&apos;t crash the system in minutes.

So, I&apos;m inclined to believe that there might be another crazy edge case.

Live long and prosper</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2534541</commentid>
    <comment_count>9</comment_count>
    <who name="Ken Vermette">vermette</who>
    <bug_when>2026-07-27 15:04:04 +0000</bug_when>
    <thetext>(In reply to Zamundaaa from comment #6)
&gt; Git commit 4d3e2c5bddd2e266e82e2d87c09c71d0908198ac by Xaver Hugl.
&gt; Committed on 17/06/2026 at 12:32.
&gt; Pushed by zamundaaa into branch &apos;Plasma/6.6&apos;.
&gt; 
&gt; wayland/xdgdecoration: ignore irrelevant preferred mode changes
&gt; 
&gt; Some clients (Firefox) request the preferred mode for some reason if it&apos;s not
&gt; honored by the compositor, which makes KWin send another configure event,
&gt; which
&gt; makes the client send another request, infinitely in a loop.
&gt; 
&gt; While Firefox shouldn&apos;t do that, KWin should also not do a bunch of
&gt; additional
&gt; work for no reason.
&gt; 
&gt; 
&gt; (cherry picked from commit 17b18492762d722906e4d5b3c434af2dfce14a38)
&gt; 
&gt; Co-authored-by: Xaver Hugl &lt;xaver.hugl@kde.org&gt;
&gt; 
&gt; M  +3    -0    src/wayland/server_decoration.cpp
&gt; M  +8    -3    src/wayland/xdgdecoration_v1.cpp
&gt; 
&gt; https://invent.kde.org/plasma/kwin/-/commit/
&gt; 4d3e2c5bddd2e266e82e2d87c09c71d0908198ac

Very nice work, thank you!

This will probably gel very nicely with the new frame-only rule being added. Much appreciated.

♥️🍪</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>