Memory leak

Russell Shaw rjshaw at netspace.net.au
Tue May 9 09:32:50 PDT 2006


Hi,
In my code, i have:

    malloc_stats();

    Xutf8DrawString(
         app->display,
         win,
         wm->fontset.fontset,
         wm->title_gc.gc,
         x,
         y,
         cli->title,
         strlen(cli->title)
    );

    malloc_stats();


malloc_stats() shows a leak of 56 bytes:

Arena 0:
system bytes     =    2834432
in use bytes     =    2540544
Total (incl. mmap):
system bytes     =    2834432
in use bytes     =    2540544
max mmap regions =          0
max mmap bytes   =          0

(gdb) next
...

Arena 0:
system bytes     =    2834432
in use bytes     =    2540600
Total (incl. mmap):
system bytes     =    2834432
in use bytes     =    2540600
max mmap regions =          0
max mmap bytes   =          0


By using a malloc hook, it seems the pointer to the memory from
Xutf8DrawString() is not freed.

Backtrace:

#0  my_malloc_hook (size=20, caller=0xb7f690ec) at main.c:331
#1  0xb7e06db5 in malloc () from /lib/tls/libc.so.6
#2  0xb7f690ec in create_tocs_conv (lcd=0x1, methods=0xb7fd8f30) at ../../../src/xlibi18n/lcUTF8.c:495
#3  0xb7f5e59c in get_converter (from_lcd=0x808ceac, from_type=130, to_lcd=0x808ceac, to_type=81) at 
../../../src/xlibi18n/lcConv.c:74
#4  0xb7f5e932 in _XlcOpenConverter (from_lcd=0x808ceac, from=0xb7d8e3a7 "utf8String", 
to_lcd=0x808ceac, to=0xb7d8e3be "charSet") at ../../../src/xlibi18n/lcConv.c:308
#5  0xb7d8e164 in _XomInitConverter (oc=0x813309c, type=XOMUtf8String) at 
../../../../modules/om/generic/omXChar.c:472
#6  0xb7d8bfb0 in _XomGenericDrawString (dpy=0x8087ffc, d=2097232, oc=0x813309c, gc=0x812ecc4, x=3, 
y=14, type=3, text=0x8122f5c "/home/russell/AAProjs/GNU/src", length=40) at 
../../../../modules/om/generic/omText.c:307
#7  0xb7d8c8a7 in _Xutf8GenericDrawString (dpy=0x3, d=3, oc=0x3, gc=0x3, x=3, y=3, text=0x3 <Address 
0x3 out of bounds>, length=3) at ../../../../modules/om/generic/omText.c:370
#8  0xb7f6bff2 in Xutf8DrawString (dpy=0x3, d=3, font_set=0x8133958, gc=0x3, x=3, y=3, text=0x3 
<Address 0x3 out of bounds>, text_len=3) at ../../../src/xlibi18n/utf8Wrap.c:127



More information about the xorg mailing list