Memleak in background extension rxvt_img::muladd

ej.lfs at xs4all.nl ej.lfs at xs4all.nl
Tue Jan 9 21:49:04 CET 2024


Hi,

I'm using rxvt-unicode-9.31, with a background image with focus_fade. 
This shows my background the way I like it, but it slowly eats all the 
memory until it starts swapping.

Digging around I seem to have found the issue (if I understand it 
correctly): in rxvt_img::muladd an image cc is composed, and based on 
that another image cc2 is composed. That image cc2 gets used, but cc and 
its pixmap are kept hanging around and it never gets freed/destroyed.
That results in a memleak the size of my backgroundpic every muladd is 
called = every time the focus on my terminal window changes.

Explicitly destroying cc->destimg at the end of muladd fixed the leak 
for me.

diff -Naur rxvt-unicode-9.31-orig/src/rxvtimg.C 
rxvt-unicode-9.31/src/rxvtimg.C
--- rxvt-unicode-9.31-orig/src/rxvtimg.C	2021-05-09 17:04:44.000000000 +0200
+++ rxvt-unicode-9.31/src/rxvtimg.C	2024-01-09 20:59:30.081764268 +0100
@@ -658,6 +658,7 @@

    XRenderComposite (cc.dpy, PictOpSrc, cc2.src, None, cc2.dst, 0, 0, 
0, 0, 0, 0, w * 2, h);

+  cc.dstimg->destroy();
    return cc2;
  }


I'm no good at c++ so people who are can no doubt find a proper 
solution, but maybe this will help someone.

Bye,
Erik-Jan



More information about the rxvt-unicode mailing list