[Xcb] Xpyb memory leak

Paul Colomiets paul at colomiets.name
Wed Jul 6 12:08:05 PDT 2011

On Wed, Jul 6, 2011 at 11:17 AM, Julien Danjou <julien at danjou.info> wrote:
> On Wed, Jul 06 2011, Paul Colomiets wrote:
>> I believe there is a memory leak in xpyb. It's somewhere in C code,
>> so garbage collector does not detects it. Basically reply objects
>> free only at exit of the program. You can find the test code at the
>> end of this email.
>> Have any body experienced similar problems?
>> Could somebody look up the problem? I've spent a few hours
>> trying to spot this bug without a success.
>> May be I use protocol in the wrong way or there is a cache,
>> so that memory growth is expected?
> I confirm. Unfortunately, I quickly tried to run the program with
> valgrind but with it crashed, so I can't see what's wrong.
Valgrind's memcheck says no definetly lost, only possibly lost data.
Valgrind's massif finds allocations of reply objects in new
snapshots (and much lower percent something else) IIRC.
Also when I decrement refcnt of reply before returning (yes, it's
dirty hack) -- no more memory leak happens, but segmentation
fault happens on exit. (I've tested a week ago or so, currently
I realized that segfault could possibly because of the reply in
current stack where KeyboardInterrupt raised, so its missing
decref somewhere. Week ago I've thought that there is still
some collection storing the reply object which is cleared on

Please, let me know if I can be of any help.

> I'd suggest open a bug report so we do not lose track of this problem
> and try to fix it ASAP.

Sorry, where is a bugtracker? :) I've filed a bug into xpyb-ng before.

BTW, how xpyb-ng is related to xpyb. Is it an independent fork? And
does anybody know which one is better?


More information about the Xcb mailing list