[Xcb] XPutImage to a pixmap is leaking memory

Jamey Sharp jamey at minilop.net
Tue Jun 1 07:49:37 PDT 2010


On Tue, Jun 1, 2010 at 5:34 AM, Guillaume Foliard <guifo at wanadoo.fr> wrote:
> Here is a rough copy/paste from the Valgrind output :
>
> ==10123== 15,984 bytes in 999 blocks are indirectly lost in loss record 21 of 25
> ==10123== at 0x4A0515D: malloc (vg_replace_malloc.c:195)
> ==10123== by 0x3B3860A6B1: ??? (in /usr/lib64/libxcb.so.1.1.0)
> ==10123== by 0x3B386088EC: ??? (in /usr/lib64/libxcb.so.1.1.0)
> ==10123== by 0x3B38608D86: ??? (in /usr/lib64/libxcb.so.1.1.0)
> ==10123== by 0x3B38609034: xcb_writev (in /usr/lib64/libxcb.so.1.1.0)
> ==10123== by 0x3B38A4D419: _XSend (in /usr/lib64/libX11.so.6.3.0)
> ==10123== by 0x3B38A3985C: ??? (in /usr/lib64/libX11.so.6.3.0)
> ==10123== by 0x3B38A38B50: ??? (in /usr/lib64/libX11.so.6.3.0)
> ==10123== by 0x3B38A39A3D: XPutImage (in /usr/lib64/libX11.so.6.3.0)
> ==10123== by 0x400B9D: main (put_image.c:76)
>
> When run on an older Linux distribution without XCB a leak is also observed, but in libX11.

Why did you comment out the XCloseDisplay call? You'll certainly see
leak reports in valgrind if you do that, making it hard to tell
whether this is really a bug.

I bet you'll find it doesn't "leak" if you call XNextEvent before the
program exits. I think you're seeing it read back the Expose event
from the MapWindow request, which you're then ignoring.

If this really is a bug, you need to install debug symbols and grab
that same stack trace from valgrind again. Looks like these
instructions apply to Fedora:

http://fedoraproject.org/wiki/StackTraces

Also, your mail client seems to have mangled your example program.
Perhaps you should make it an attachment instead.

Jamey


More information about the Xcb mailing list