Client memory leak with XCopyArea() call?

Ryan B. Lynch rlynch at
Fri Apr 8 11:21:47 PDT 2005

Thanks!  That was exactly it.  I inserted a sub-loop into the main 
while() loop that checks the size of the event queue with QLength(), 
retrieves and throws away all the events on the queue, and then proceeds 
with the rest of the main loop.  Works perfectly.

This has been puzzling me for days, now.  Thank you so much.


Owen Taylor wrote:

>On Fri, 2005-04-08 at 17:17 +0000, Ryan B. Lynch wrote:
>>I'm pretty new to Xlib programming, and I'm observing a behavior that 
>>seems like a memory leak.  I'm using x11 6.7.0, right now, compiled from 
>>source on CRUX Linux.
>>First, I create a window.
>>Then, in a while(1) loop, I:
>>    - call XCreatePixmap() to instantiate a new pixmap,
>>    - draw some stuff on the pixmap,
>>    - call XCopyArea to copy the pixmap contents to the window,
>>    - call XFreePixmap to destroy the pixmap.
>Most likely your XCopyArea calls are creating GraphicsExpose events
>(the default GC values have them on) and you aren't processing events,
>so the events accumulate in the event queue.
>						Owen

More information about the xorg mailing list