Re: [Valgrind-users] debugging gtk-related memory leaks

2006-09-06 Thread David Ellis
I tried it with the debug info packages and malloc, and now there are 
only a few X/gtk errors. Anyone have suggestions on how to approach 
those? Maybe someone on the gtk-app-devel-list?


Thanks,

David


Julian Seward wrote:


Maybe you should set G_SLICE=always-malloc in the environment in order
to make valgrind more useful:

 http://developer.gnome.org/doc/API/2.0/glib/glib-running.html
   



I agree; from a guess I'd say that glib is using a private allocator, 
which confuses the issue.


Unrelatedly ..

It looks like the 'valgrind-3.1.1-Debian' you are using has been
shipped without a set of suppressions suitable for getting rid of
all the complaints of the form

==3722== Conditional jump or move depends on uninitialised value(s)
==3722==at 0x401139F: (within /lib/ld-2.3.6.so)
==3722==by 0x4006ACE: (within /lib/ld-2.3.6.so)
==3722==by 0x48A14AF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)

which is a shame.  It may be that if you install debug info packages
for /lib/ld-2.3.6.so and/or libc-2.3.6.so, that noise will go away.

J
 

==25785== Memcheck, a memory error detector.
==25785== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==25785== Using LibVEX rev 1575, a library for dynamic binary translation.
==25785== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==25785== Using valgrind-3.1.1-Debian, a dynamic binary instrumentation 
framework.
==25785== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==25785== For more details, rerun with: -v
==25785== 
==25785== Syscall param write(buf) points to uninitialised byte(s)
==25785==at 0x4836783: __write_nocancel (in 
/lib/tls/i686/cmov/libpthread-2.3.6.so)
==25785==by 0x4D16E3E: _X11TransWrite (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4D1BB54: (within /usr/lib/libX11.so.6.2.0)
==25785==by 0x4D1BC7C: _XReply (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4D01862: XInternAtom (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4D160EA: XSetWMProperties (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4B90C59: (within /usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x4B93B25: gdk_window_new (in 
/usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x4B71F9B: gdk_display_open (in 
/usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x4B510DE: gdk_display_open_default_libgtk_only (in 
/usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x497378E: gtk_init_check (in 
/usr/lib/libgtk-x11-2.0.so.0.800.17)
==25785==by 0x49737C3: gtk_init (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
==25785==  Address 0x5210FD0 is 128 bytes inside a block of size 16,384 alloc'd
==25785==at 0x480788E: calloc (vg_replace_malloc.c:279)
==25785==by 0x4D06B83: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4B71EC1: gdk_display_open (in 
/usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x4B510DE: gdk_display_open_default_libgtk_only (in 
/usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x497378E: gtk_init_check (in 
/usr/lib/libgtk-x11-2.0.so.0.800.17)
==25785==by 0x49737C3: gtk_init (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
==25785==by 0x8059238: main_gui(int, char**) (gui.C:108)
==25785==by 0x804F6B1: main (time.C:83)
==25785== 
==25785== Syscall param write(buf) points to uninitialised byte(s)
==25785==at 0x48367AB: (within /lib/tls/i686/cmov/libpthread-2.3.6.so)
==25785==by 0x4D16E3E: _X11TransWrite (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4D1BB54: (within /usr/lib/libX11.so.6.2.0)
==25785==by 0x4D1CEAB: _XEventsQueued (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4D08792: XPending (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4B7E9CD: _gdk_events_queue (in 
/usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x4B7EBCE: (within /usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x4E0F690: g_main_context_dispatch (in 
/usr/lib/libglib-2.0.so.0.1000.2)
==25785==by 0x4E129D6: (within /usr/lib/libglib-2.0.so.0.1000.2)
==25785==by 0x4E12F27: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.1000.2)
==25785==by 0x4974340: gtk_main (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
==25785==by 0x80595D3: main_gui(int, char**) (gui.C:157)
==25785==  Address 0x52110F4 is 420 bytes inside a block of size 16,384 alloc'd
==25785==at 0x480788E: calloc (vg_replace_malloc.c:279)
==25785==by 0x4D06B83: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
==25785==by 0x4B71EC1: gdk_display_open (in 
/usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x4B510DE: gdk_display_open_default_libgtk_only (in 
/usr/lib/libgdk-x11-2.0.so.0.800.17)
==25785==by 0x497378E: gtk_init_check (in 
/usr/lib/libgtk-x11-2.0.so.0.800.17)
==25785==by 0x49737C3: gtk_init (in /usr/lib/libgtk-x11-2.0.so.0.800.17)
==25785==by 0x8059238: main_gui(int, char**) (gui.C:108)
==25785==by 0x804F6B1: main (time.C:83)
join engine...
==25785== 
==25785== Syscall param write(buf) points to uninitialised byte(s)
==25785==

debugging gtk-related memory leaks

2006-08-20 Thread David Ellis
Hello,

Could anyone offer help or advice on debugging mysterious gtk-related memory
leaks and errors reported by valgrind when checking a threaded GTK+
program? The primary "potential" leak seems to be a sizeable chunk in
g_thread_init, and there are quite a few errors from various unknown
contexts (including g_module_open).

Please take a look at the attached valgrind --leak-check=full output,
and/or offer general advice on pursuing such errors and leaks, which are
almost undoubtedly caused by my code, yet do not appear to come from any
context I am familiar with. Is there some procedure for cleaning up
g_threads, apart from adding a window "destroy" handler like
gtk_main_quit?

Thanks,

David
==3722== Memcheck, a memory error detector.
==3722== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==3722== Using LibVEX rev 1575, a library for dynamic binary translation.
==3722== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==3722== Using valgrind-3.1.1-Debian, a dynamic binary instrumentation 
framework.
==3722== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==3722== For more details, rerun with: -v
==3722== 
==3722== Conditional jump or move depends on uninitialised value(s)
==3722==at 0x4011394: (within /lib/ld-2.3.6.so)
==3722==by 0x4006ACE: (within /lib/ld-2.3.6.so)
==3722==by 0x48A14AF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x48A1E6A: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x45F9D27: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x45FA456: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x45F9D80: dlopen (in /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x45398F8: (within /usr/lib/libX11.so.6.2.0)
==3722==by 0x4539B42: _XlcDynamicLoad (in /usr/lib/libX11.so.6.2.0)
==3722==by 0x454E108: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==3722== 
==3722== Conditional jump or move depends on uninitialised value(s)
==3722==at 0x401139F: (within /lib/ld-2.3.6.so)
==3722==by 0x4006ACE: (within /lib/ld-2.3.6.so)
==3722==by 0x48A14AF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x48A1E6A: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x45F9D27: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x45FA456: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x45F9D80: dlopen (in /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x45398F8: (within /usr/lib/libX11.so.6.2.0)
==3722==by 0x4539B42: _XlcDynamicLoad (in /usr/lib/libX11.so.6.2.0)
==3722==by 0x454E108: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==3722== 
==3722== Conditional jump or move depends on uninitialised value(s)
==3722==at 0x40113AA: (within /lib/ld-2.3.6.so)
==3722==by 0x4006ACE: (within /lib/ld-2.3.6.so)
==3722==by 0x48A14AF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x48A1E6A: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x45F9D27: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x45FA456: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x45F9D80: dlopen (in /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x45398F8: (within /usr/lib/libX11.so.6.2.0)
==3722==by 0x4539B42: _XlcDynamicLoad (in /usr/lib/libX11.so.6.2.0)
==3722==by 0x454E108: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==3722== 
==3722== Conditional jump or move depends on uninitialised value(s)
==3722==at 0x40114DA: (within /lib/ld-2.3.6.so)
==3722==by 0x4006ACE: (within /lib/ld-2.3.6.so)
==3722==by 0x48A14AF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x48A1E6A: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x45F9D27: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x45FA456: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x45F9D80: dlopen (in /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x45398F8: (within /usr/lib/libX11.so.6.2.0)
==3722==by 0x4539B42: _XlcDynamicLoad (in /usr/lib/libX11.so.6.2.0)
==3722==by 0x454E108: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==3722== 
==3722== Conditional jump or move depends on uninitialised value(s)
==3722==at 0x40114DA: (within /lib/ld-2.3.6.so)
==3722==by 0x400717A: (within /lib/ld-2.3.6.so)
==3722==by 0x48A14AF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722==by 0x48A1E6A: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==3722==by 0x45F9D27: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==3722==by 0x400BA5E: (within /lib/ld-2.3.6.so)
==3722