GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Nov 23, 2014 8:03 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: valgrind..
PostPosted: Mon Mar 19, 2007 5:32 pm 
Offline
Familiar Face

Joined: Sat Feb 24, 2007 11:40 am
Posts: 9
Hi, I'm back with a question..
I usually test my programs with valgrind. So I also tested my gtk program, the result: many many errors.
So what can I do? I think my code is correct. I checked another program from my linux distribution, gqview, which also causes similar errors.
Is this normal? What can I do to prevent those errors? I ask this, because the printing of such a mess makes it quite impossible to find the "real" errors in my code.

Regards

Code:
==4051== Memcheck, a memory error detector.
==4051== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==4051== Using LibVEX rev 1732, a library for dynamic binary translation.
==4051== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==4051== Using valgrind-3.2.3-Debian, a dynamic binary instrumentation framework.
==4051== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==4051== For more details, rerun with: -v
==4051==
==4051== Conditional jump or move depends on uninitialised value(s)
==4051==    at 0x4010CF3: (within /lib/ld-2.3.6.so)
==4051==    by 0x4006704: (within /lib/ld-2.3.6.so)
==4051==    by 0x479A36F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x4799DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x4604D8D: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x460542C: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==4051==    by 0x4604D20: dlopen (in /lib/tls/i686/cmov/libdl-2.3.6.so)
==4051==    by 0x4543075: (within /usr/lib/libX11.so.6.2.0)
==4051==    by 0x4543B40: _XlcDynamicLoad (in /usr/lib/libX11.so.6.2.0)
==4051==    by 0x455770E: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==4051==

[.. errors ...]

==4051==
==4051== Invalid read of size 4
==4051==    at 0x4010DE9: (within /lib/ld-2.3.6.so)
==4051==    by 0x4004B78: (within /lib/ld-2.3.6.so)
==4051==    by 0x4006792: (within /lib/ld-2.3.6.so)
==4051==    by 0x479A36F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x4799DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x479C5FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x479C65D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x477670F: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x47767FF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x4778425: __nss_passwd_lookup (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==  Address 0x492A5E4 is 36 bytes inside a block of size 38 alloc'd
==4051==    at 0x401C4B0: malloc (vg_replace_malloc.c:149)
==4051==    by 0x4006B83: (within /lib/ld-2.3.6.so)
==4051==    by 0x479A36F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x4799DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x479C5FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x479C65D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x477670F: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x47767FF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x4778425: __nss_passwd_lookup (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x47268BE: getpwnam_r (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==
==4051== Invalid read of size 4
==4051==    at 0x4010E17: (within /lib/ld-2.3.6.so)
==4051==    by 0x4004B78: (within /lib/ld-2.3.6.so)
==4051==    by 0x4006792: (within /lib/ld-2.3.6.so)
==4051==    by 0x400A1F6: (within /lib/ld-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x400A3CA: (within /lib/ld-2.3.6.so)
==4051==    by 0x479A3D4: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x4799DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x479C5FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x479C65D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==  Address 0x492A91C is 28 bytes inside a block of size 31 alloc'd
==4051==    at 0x401C4B0: malloc (vg_replace_malloc.c:149)
==4051==    by 0x4006B83: (within /lib/ld-2.3.6.so)
==4051==    by 0x400A1F6: (within /lib/ld-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x400A3CA: (within /lib/ld-2.3.6.so)
==4051==    by 0x479A3D4: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x4799DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x479C5FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==4051==    by 0x479C65D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==    by 0x477670F: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==4051==

[.. errors ...]

==4051==
==4051== Syscall param write(buf) points to uninitialised byte(s)
==4051==    at 0x4000792: (within /lib/ld-2.3.6.so)
==4051==    by 0x453687E: _X11TransWrite (in /usr/lib/libX11.so.6.2.0)
==4051==    by 0x453C185: (within /usr/lib/libX11.so.6.2.0)
==4051==    by 0x4518AF0: XFlush (in /usr/lib/libX11.so.6.2.0)
==4051==    by 0x4380F9A: gdk_display_flush (in /usr/lib/libgdk-x11-2.0.so.0.800.20)
==4051==    by 0x4379099: gdk_window_process_all_updates (in /usr/lib/libgdk-x11-2.0.so.0.800.20)
==4051==    by 0x43790E4: (within /usr/lib/libgdk-x11-2.0.so.0.800.20)
==4051==    by 0x4631DA0: (within /usr/lib/libglib-2.0.so.0.1200.6)
==4051==    by 0x4633B20: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.1200.6)
==4051==    by 0x4636B95: (within /usr/lib/libglib-2.0.so.0.1200.6)
==4051==    by 0x4636F56: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.1200.6)
==4051==    by 0x418A280: gtk_main (in /usr/lib/libgtk-x11-2.0.so.0.800.20)
==4051==  Address 0x492DB05 is 397 bytes inside a block of size 16,384 alloc'd
==4051==    at 0x401B7EF: calloc (vg_replace_malloc.c:279)
==4051==    by 0x452724D: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
==4051==    by 0x4381921: gdk_display_open (in /usr/lib/libgdk-x11-2.0.so.0.800.20)
==4051==    by 0x436018E: gdk_display_open_default_libgtk_only (in /usr/lib/libgdk-x11-2.0.so.0.800.20)
==4051==    by 0x418A84E: gtk_init_check (in /usr/lib/libgtk-x11-2.0.so.0.800.20)
==4051==    by 0x418A883: gtk_init (in /usr/lib/libgtk-x11-2.0.so.0.800.20)
==4051==    by 0x804D72C: main (in /home/FOLDEROFAPPLICATION ;-))

[and so on....]





Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 5:47 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
Yes. Regardless of what you do, Valgrind is going to crap on your screen when you are using GTK+. I would recommend just going through your Valgrind output, searching for non-GTK+ leaks.

If you want to profile GTK+ aspects of an application, use g_mem_profile(). More information can be found at: http://developer.gnome.org/doc/API/2.0/ ... em-profile

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 6:01 pm 
Offline
Familiar Face

Joined: Sat Feb 24, 2007 11:40 am
Posts: 9
Thanks for information, this is good to hear :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group