GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

valgrind..

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
rotalever
Familiar Face


Joined: 24 Feb 2007
Posts: 11

PostPosted: Mon Mar 19, 2007 5:32 pm    Post subject: valgrind.. Reply with quote

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: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

==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....]



Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 386
Location: Fairfax, Virginia

PostPosted: Mon Mar 19, 2007 5:47 pm    Post subject: Reply with quote

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/glib/glib-Memory-Allocation.html#g-mem-profile
Back to top
rotalever
Familiar Face


Joined: 24 Feb 2007
Posts: 11

PostPosted: Mon Mar 19, 2007 6:01 pm    Post subject: Reply with quote

Thanks for information, this is good to hear :D
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP