Re: GLib/GModule Memory Leak? [now also GThread]



I reran after implementing my app using GThreads and still got the
attached results after using: env G_DEBUG=gc-friendly
G_SLICE=always-malloc valgrind --leak-check=full --show-reachable=yes.
Notice also that there may be a small leak with g_thread_create().  Of
course this could also be how I'm using it.  However, my usage is fairly
simple: I just create one thread to do a download, I process some stuff
in the foreground and then do a join() when I need the content from the
download.  Anyway, thanks for the help so far.

Nathaniel

On Sun, 16 Apr 2006, Kalle Vahlman wrote:
>On 4/15/06, Nathaniel McCallum <npmccallum gentoo org> wrote:
>> I hope this is the right list to ask this on.  I ran valgrind on an
>> application I'm developing with glib using gmodule.  Results attached.
>
>I'm under the impression that valgrind and the new slice allocator
>code do not really mix. There is a way to turn it to mallocs for
>memory debugging, see
>
>  http://developer.gnome.org/doc/API/2.0/glib/glib-running.html
>
>and "G_SLICE" for details.
>
>> Am I just worried about something that's not a big deal or is this a bug
>> I should file?
>
>Most likely no, but if you rerun with the always-malloc you should know better.
==24649== Memcheck, a memory error detector.
==24649== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==24649== Using LibVEX rev 1471, a library for dynamic binary translation.
==24649== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==24649== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
==24649== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==24649== For more details, rerun with: -v
==24649== 
==24649== 
==24649== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 101 from 1)
==24649== malloc/free: in use at exit: 26,289 bytes in 321 blocks.
==24649== malloc/free: 62,943 allocs, 62,622 frees, 2,704,716 bytes allocated.
==24649== For counts of detected errors, rerun with: -v
==24649== searching for pointers to 321 not-freed blocks.
==24649== checked 10,952,536 bytes.
==24649== 
==24649== 8 bytes in 2 blocks are still reachable in loss record 1 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0xBE6CD2: _dl_map_object_from_fd (in /lib/ld-2.4.so)
==24649==    by 0xBE8118: _dl_map_object (in /lib/ld-2.4.so)
==24649==    by 0xBEBCA5: openaux (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBEC245: _dl_map_object_deps (in /lib/ld-2.4.so)
==24649==    by 0xBF1172: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649== 
==24649== 
==24649== 20 bytes in 1 blocks are still reachable in loss record 2 of 17
==24649==    at 0x40045EB: calloc (vg_replace_malloc.c:279)
==24649==    by 0xD5A45D: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049BFE: main (noweb.c:49)
==24649== 
==24649== 
==24649== 32 bytes in 1 blocks are still reachable in loss record 3 of 17
==24649==    at 0x40052ED: realloc (vg_replace_malloc.c:306)
==24649==    by 0x99D5FA: g_realloc (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x97E220: (within /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x97E5A3: g_array_set_size (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x9B43CC: g_static_private_set (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x9BA4ED: g_get_charset (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x981307: g_get_filename_charsets (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x981530: (within /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x9B44C4: g_thread_init_glib (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x3F618D: g_thread_init (in /usr/lib/libgthread-2.0.so.0.1000.2)
==24649==    by 0x8049B5F: main (noweb.c:37)
==24649== 
==24649== 
==24649== 79 bytes in 1 blocks are still reachable in loss record 4 of 17
==24649==    at 0x40052ED: realloc (vg_replace_malloc.c:306)
==24649==    by 0xC58ADE: vasprintf (in /lib/libc-2.4.so)
==24649==    by 0xC4035D: asprintf (in /lib/libc-2.4.so)
==24649==    by 0xD5A24C: dlerror (in /lib/libdl-2.4.so)
==24649==    by 0xDD4FFE: (within /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0xDD51ED: g_module_symbol (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0xDD5665: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049BFE: main (noweb.c:49)
==24649== 
==24649== 
==24649== 96 bytes in 3 blocks are still reachable in loss record 5 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0xBF156A: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049BFE: main (noweb.c:49)
==24649== 
==24649== 
==24649== 136 bytes in 1 blocks are possibly lost in loss record 6 of 17
==24649==    at 0x40045EB: calloc (vg_replace_malloc.c:279)
==24649==    by 0xBF04FA: _dl_allocate_tls (in /lib/ld-2.4.so)
==24649==    by 0x24DC9E2: pthread_create@@GLIBC_2.1 (in /lib/libpthread-2.4.so)
==24649==    by 0x3F5669: (within /usr/lib/libgthread-2.0.so.0.1000.2)
==24649==    by 0x9B3911: g_thread_create_full (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x804BDC4: nw_request_begin_content_download (nw_request.c:34)
==24649==    by 0x804A76D: nw_config_score_request (nw_config.c:234)
==24649==    by 0x8049F4D: main (noweb.c:123)
==24649== 
==24649== 
==24649== 292 bytes in 7 blocks are still reachable in loss record 7 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0xBE758B: expand_dynamic_string_token (in /lib/ld-2.4.so)
==24649==    by 0xBE805E: _dl_map_object (in /lib/ld-2.4.so)
==24649==    by 0xBF1113: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049BFE: main (noweb.c:49)
==24649== 
==24649== 
==24649== 328 bytes in 15 blocks are still reachable in loss record 8 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0xBE85F0: _dl_map_object (in /lib/ld-2.4.so)
==24649==    by 0xBEBCA5: openaux (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBEC245: _dl_map_object_deps (in /lib/ld-2.4.so)
==24649==    by 0xBF1172: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649== 
==24649== 
==24649== 564 bytes in 7 blocks are still reachable in loss record 9 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0xBEC53D: _dl_map_object_deps (in /lib/ld-2.4.so)
==24649==    by 0xBF1172: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049BFE: main (noweb.c:49)
==24649== 
==24649== 
==24649== 612 bytes in 15 blocks are still reachable in loss record 10 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0xBEC2B6: _dl_map_object_deps (in /lib/ld-2.4.so)
==24649==    by 0xBF1172: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049BFE: main (noweb.c:49)
==24649== 
==24649== 
==24649== 620 bytes in 22 blocks are still reachable in loss record 11 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0xBEA363: _dl_new_object (in /lib/ld-2.4.so)
==24649==    by 0xBE5EC3: _dl_map_object_from_fd (in /lib/ld-2.4.so)
==24649==    by 0xBE8118: _dl_map_object (in /lib/ld-2.4.so)
==24649==    by 0xBF1113: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649== 
==24649== 
==24649== 808 bytes in 9 blocks are still reachable in loss record 12 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0x22CC5D: (within /lib/libcrypto.so.0.9.8a)
==24649==    by 0x22D2DE: CRYPTO_malloc (in /lib/libcrypto.so.0.9.8a)
==24649==    by 0x26F6A0: ENGINE_new (in /lib/libcrypto.so.0.9.8a)
==24649==    by 0x27596B: ENGINE_load_dynamic (in /lib/libcrypto.so.0.9.8a)
==24649==    by 0x271BA6: ENGINE_load_builtin_engines (in /lib/libcrypto.so.0.9.8a)
==24649==    by 0x8D5766: Curl_ossl_init (in /usr/lib/libcurl.so.3.0.0)
==24649==    by 0x8E3D4B: Curl_ssl_init (in /usr/lib/libcurl.so.3.0.0)
==24649==    by 0x8DCCF1: curl_global_init (in /usr/lib/libcurl.so.3.0.0)
==24649==    by 0x4019C1B: libcurl_get_http_data (network_libcurl.c:72)
==24649==    by 0x804B2E3: nw_network_get_http_data (nw_network.c:90)
==24649==    by 0x9B3A1E: (within /usr/lib/libglib-2.0.so.0.1000.2)
==24649== 
==24649== 
==24649== 1,792 bytes in 10 blocks are still reachable in loss record 13 of 17
==24649==    at 0x40045EB: calloc (vg_replace_malloc.c:279)
==24649==    by 0x99D69D: g_malloc0 (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x9B34CB: g_thread_self (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x9B426E: g_static_private_set (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0xDD5089: g_module_supported (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049B33: main (noweb.c:32)
==24649== 
==24649== 
==24649== 2,280 bytes in 6 blocks are still reachable in loss record 14 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0x4005271: realloc (vg_replace_malloc.c:306)
==24649==    by 0xBEA052: _dl_lookup_symbol_x (in /lib/ld-2.4.so)
==24649==    by 0xBEAD19: _dl_relocate_object (in /lib/ld-2.4.so)
==24649==    by 0xBF144B: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649== 
==24649== 
==24649== 2,529 bytes in 177 blocks are still reachable in loss record 15 of 17
==24649==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==24649==    by 0x99D735: g_malloc (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x9AD4D7: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x97E688: g_array_sized_new (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x97E796: g_array_new (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0x9B43F2: g_static_private_set (in /usr/lib/libglib-2.0.so.0.1000.2)
==24649==    by 0xDD5089: g_module_supported (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049B33: main (noweb.c:32)
==24649== 
==24649== 
==24649== 2,736 bytes in 22 blocks are still reachable in loss record 16 of 17
==24649==    at 0x40045EB: calloc (vg_replace_malloc.c:279)
==24649==    by 0xBEEE64: _dl_check_map_versions (in /lib/ld-2.4.so)
==24649==    by 0xBF1465: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649==    by 0x8049BFE: main (noweb.c:49)
==24649== 
==24649== 
==24649== 13,357 bytes in 22 blocks are still reachable in loss record 17 of 17
==24649==    at 0x40045EB: calloc (vg_replace_malloc.c:279)
==24649==    by 0xBEA0D9: _dl_new_object (in /lib/ld-2.4.so)
==24649==    by 0xBE5EC3: _dl_map_object_from_fd (in /lib/ld-2.4.so)
==24649==    by 0xBE8118: _dl_map_object (in /lib/ld-2.4.so)
==24649==    by 0xBF1113: dl_open_worker (in /lib/ld-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xBF0C19: _dl_open (in /lib/ld-2.4.so)
==24649==    by 0xD59E03: dlopen_doit (in /lib/libdl-2.4.so)
==24649==    by 0xBED6C8: _dl_catch_error (in /lib/ld-2.4.so)
==24649==    by 0xD5A3FF: _dlerror_run (in /lib/libdl-2.4.so)
==24649==    by 0xD59D48: dlopen@@GLIBC_2.1 (in /lib/libdl-2.4.so)
==24649==    by 0xDD5558: g_module_open (in /usr/lib/libgmodule-2.0.so.0.1000.2)
==24649== 
==24649== LEAK SUMMARY:
==24649==    definitely lost: 0 bytes in 0 blocks.
==24649==      possibly lost: 136 bytes in 1 blocks.
==24649==    still reachable: 26,153 bytes in 320 blocks.
==24649==         suppressed: 0 bytes in 0 blocks.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]