Created
October 20, 2010 17:05
-
-
Save hannahwhy/636834 to your computer and use it in GitHub Desktop.
libxcb leaks like a sieve
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <X11/Xlib.h> | |
| int main(int argc, char **argv) | |
| { | |
| Display *d; | |
| int ret; | |
| d = XOpenDisplay(argv[1]); | |
| ret = d ? 0 : 1; | |
| if (d) { | |
| XCloseDisplay(d); | |
| } | |
| return ret; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reserved-dhcp-165-124-223-118:test-x-connection davidyip$ valgrind -v --leak-check=full --show-reachable=yes ./test-x-connection :1 | |
| ==99740== Memcheck, a memory error detector | |
| ==99740== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. | |
| ==99740== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info | |
| ==99740== Command: ./test-x-connection :1 | |
| ==99740== | |
| --99740-- Valgrind options: | |
| --99740-- -v | |
| --99740-- --leak-check=full | |
| --99740-- --show-reachable=yes | |
| --99740-- Contents of /proc/version: | |
| --99740-- can't open /proc/version | |
| --99740-- Arch and hwcaps: X86, x86-sse1-sse2 | |
| --99740-- Page sizes: currently 4096, max supported 4096 | |
| --99740-- Valgrind library directory: /opt/local/lib/valgrind | |
| --99740-- ./test-x-connection (0x1000) | |
| --99740-- reading syms from primary file (7 3) | |
| --99740-- dSYM directory is missing; consider using --dsymutil=yes | |
| --99740-- /usr/lib/dyld (0x8fe00000) | |
| --99740-- reading syms from primary file (17 982) | |
| --99740-- Reading suppressions file: /opt/local/lib/valgrind/default.supp | |
| --99740-- REDIR: 0x8fe21e00 (strlen) redirected to 0xf00c47ac (???) | |
| --99740-- REDIR: 0x8fe22000 (strcpy) redirected to 0xf00c47ff (???) | |
| --99740-- REDIR: 0x8fe22177 (strcat) redirected to 0xf00c47bd (???) | |
| --99740-- REDIR: 0x8fe220c0 (strcmp) redirected to 0xf00c47df (???) | |
| --99740-- /opt/local/var/macports/software/valgrind/3.5.0_1/opt/local/lib/valgrind/vgpreload_core-x86-darwin.so (0xa000) | |
| --99740-- reading syms from primary file (3 584) | |
| --99740-- dSYM= /opt/local/var/macports/software/valgrind/3.5.0_1/opt/local/lib/valgrind/vgpreload_core-x86-darwin.so.dSYM/Contents/Resources/DWARF/vgpreload_core-x86-darwin.so | |
| --99740-- reading dwarf3 from dsyms file | |
| --99740-- /opt/local/var/macports/software/valgrind/3.5.0_1/opt/local/lib/valgrind/vgpreload_memcheck-x86-darwin.so (0x14000) | |
| --99740-- reading syms from primary file (111 1045) | |
| --99740-- dSYM= /opt/local/var/macports/software/valgrind/3.5.0_1/opt/local/lib/valgrind/vgpreload_memcheck-x86-darwin.so.dSYM/Contents/Resources/DWARF/vgpreload_memcheck-x86-darwin.so | |
| --99740-- reading dwarf3 from dsyms file | |
| ==99740== WARNING: new redirection conflicts with existing -- ignoring it | |
| --99740-- new: 0x8fe21ee0 (strlcat ) R-> 0x000189c0 strlcat | |
| ==99740== WARNING: new redirection conflicts with existing -- ignoring it | |
| --99740-- new: 0x8fe22000 (strcpy ) R-> 0x00018c10 strcpy | |
| --99740-- REDIR: 0x8fe22340 (memset) redirected to 0x17fd0 (memset) | |
| --99740-- REDIR: 0x8fe21ce3 (strrchr) redirected to 0x179e0 (strrchr) | |
| --99740-- /opt/local/lib/libX11.6.dylib (0x121000) | |
| --99740-- reading syms from primary file (1233 1272) | |
| --99740-- /opt/local/lib/libxcb.1.dylib (0x27000) | |
| --99740-- reading syms from primary file (484 310) | |
| --99740-- /opt/local/lib/libXau.6.dylib (0x41000) | |
| --99740-- reading syms from primary file (8 12) | |
| --99740-- /opt/local/lib/libXdmcp.6.dylib (0x45000) | |
| --99740-- reading syms from primary file (45 9) | |
| --99740-- /usr/lib/libgcc_s.1.dylib (0x4b000) | |
| --99740-- reading syms from primary file (85 0) | |
| --99740-- /usr/lib/libSystem.B.dylib (0x242000) | |
| --99740-- reading syms from primary file (4037 3508) | |
| --99740-- /usr/lib/system/libmathCommon.A.dylib (0x58000) | |
| --99740-- reading syms from primary file (32 33) | |
| --99740-- REDIR: 0x8fe21e50 (strlcpy) redirected to 0x190a0 (strlcpy) | |
| --99740-- REDIR: 0x2433b8 (memset) redirected to 0x17f70 (memset) | |
| --99740-- REDIR: 0x2492e0 (memcpy) redirected to 0x191b0 (memcpy) | |
| --99740-- REDIR: 0x24b7e4 (calloc) redirected to 0x17026 (calloc) | |
| --99740-- REDIR: 0x244015 (malloc) redirected to 0x15396 (malloc) | |
| --99740-- REDIR: 0x24c110 (strncmp) redirected to 0x17ba0 (strncmp) | |
| --99740-- REDIR: 0x24ea62 (strrchr) redirected to 0x17980 (strrchr) | |
| --99740-- REDIR: 0x24bf00 (strlen) redirected to 0x17b80 (strlen) | |
| --99740-- REDIR: 0x249303 (free) redirected to 0x1673f (free) | |
| --99740-- REDIR: 0x26d830 (strcpy) redirected to 0x18b50 (strcpy) | |
| --99740-- REDIR: 0x26c221 (strchr) redirected to 0x17a40 (strchr) | |
| --99740-- REDIR: 0x24d870 (realloc) redirected to 0x171ca (realloc) | |
| --99740-- REDIR: 0x24e520 (memmove) redirected to 0x18030 (memmove) | |
| --99740-- REDIR: 0x8fe22494 (memmove) redirected to 0x180c0 (memmove) | |
| ==99740== | |
| ==99740== HEAP SUMMARY: | |
| ==99740== in use at exit: 1,319 bytes in 32 blocks | |
| ==99740== total heap usage: 206 allocs, 174 frees, 18,210 bytes allocated | |
| ==99740== | |
| ==99740== Searching for pointers to 32 not-freed blocks | |
| ==99740== Checked 727,956 bytes | |
| ==99740== | |
| ==99740== 28 bytes in 1 blocks are indirectly lost in loss record 1 of 11 | |
| ==99740== at 0x15416: malloc (vg_replace_malloc.c:195) | |
| ==99740== by 0x14DE51: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136456: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== 28 bytes in 1 blocks are indirectly lost in loss record 2 of 11 | |
| ==99740== at 0x15416: malloc (vg_replace_malloc.c:195) | |
| ==99740== by 0x14DE69: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136456: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== 43 bytes in 1 blocks are definitely lost in loss record 3 of 11 | |
| ==99740== at 0x15416: malloc (vg_replace_malloc.c:195) | |
| ==99740== by 0x14DD28: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136456: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== 64 bytes in 1 blocks are still reachable in loss record 5 of 11 | |
| ==99740== at 0x15416: malloc (vg_replace_malloc.c:195) | |
| ==99740== by 0x248D76: localeconv_l (in /usr/lib/libSystem.B.dylib) | |
| ==99740== by 0x244334: __vfprintf (in /usr/lib/libSystem.B.dylib) | |
| ==99740== by 0x268B89: snprintf (in /usr/lib/libSystem.B.dylib) | |
| ==99740== by 0x14DD9B: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136456: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== 112 bytes in 4 blocks are indirectly lost in loss record 6 of 11 | |
| ==99740== at 0x15416: malloc (vg_replace_malloc.c:195) | |
| ==99740== by 0x14DE51: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136D67: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== 112 bytes in 4 blocks are indirectly lost in loss record 7 of 11 | |
| ==99740== at 0x15416: malloc (vg_replace_malloc.c:195) | |
| ==99740== by 0x14DE69: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136D67: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== 116 (60 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 8 of 11 | |
| ==99740== at 0x170D8: calloc (vg_replace_malloc.c:418) | |
| ==99740== by 0x14DCD3: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136456: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== 172 bytes in 4 blocks are definitely lost in loss record 9 of 11 | |
| ==99740== at 0x15416: malloc (vg_replace_malloc.c:195) | |
| ==99740== by 0x14DD28: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136D67: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== 464 (240 direct, 224 indirect) bytes in 4 blocks are definitely lost in loss record 11 of 11 | |
| ==99740== at 0x170D8: calloc (vg_replace_malloc.c:418) | |
| ==99740== by 0x14DCD3: _XConnectXCB (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x136D67: XOpenDisplay (in /opt/local/lib/libX11.6.dylib) | |
| ==99740== by 0x1FD7: main (in ./test-x-connection) | |
| ==99740== | |
| ==99740== LEAK SUMMARY: | |
| ==99740== definitely lost: 515 bytes in 10 blocks | |
| ==99740== indirectly lost: 280 bytes in 10 blocks | |
| ==99740== possibly lost: 0 bytes in 0 blocks | |
| ==99740== still reachable: 64 bytes in 1 blocks | |
| ==99740== suppressed: 460 bytes in 11 blocks | |
| ==99740== | |
| ==99740== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) | |
| --99740-- | |
| --99740-- used_suppression: 1 darwin-still-reachable-1 | |
| --99740-- used_suppression: 1 darwin-still-reachable-2 | |
| ==99740== | |
| ==99740== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment