Hi,

I have noticed this in my application and then tested using "hello world"
code copied from the bottom of the website:
http://library.gnome.org/devel/gtk-tutorial/2.15/c39.html

I have compiled it using:

> gcc -Wall -g simple.c -o helloworld `pkg-config --cflags gtk+-2.0`
> `pkg-config --libs gtk+-2.0`
>

and run:

>   valgrind --leak-check=yes ./helloworld


Here is what valgrind reports right at the begining:

==5425== Memcheck, a memory error detector.
> ==5425== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
> ==5425== Using LibVEX rev 1732, a library for dynamic binary translation.
> ==5425== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
> ==5425== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
> ==5425== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
> ==5425== For more details, rerun with: -v
> ==5425==
> ==5425== Syscall param writev(vector[...]) points to uninitialised byte(s)
> ==5425==    at 0x691FE8: writev (in /lib/libc-2.6.so)
> ==5425==    by 0x85BA3D: (within /usr/lib/libX11.so.6.2.0)
> ==5425==    by 0x85B82E: _X11TransWritev (in /usr/lib/libX11.so.6.2.0)
> ==5425==    by 0x861558: _XSend (in /usr/lib/libX11.so.6.2.0)
> ==5425==    by 0x85244A: XQueryExtension (in /usr/lib/libX11.so.6.2.0)
> ==5425==    by 0x846D4A: XInitExtension (in /usr/lib/libX11.so.6.2.0)
> ==5425==    by 0xBFDC7F: XFixesFindDisplay (in /usr/lib/libXfixes.so.3.1.0)
> ==5425==    by 0xBFDF1C: XFixesQueryExtension (in
> /usr/lib/libXfixes.so.3.1.0)
> ==5425==    by 0xAF46B4: gdk_display_open (in
> /usr/lib/libgdk-x11-2.0.so.0.1000.14)
> ==5425==    by 0xAD1D7E: gdk_display_open_default_libgtk_only (in
> /usr/lib/libgdk-x11-2.0.so.0.1000.14)
> ==5425==    by 0x41474CE: gtk_init_check (in
> /usr/lib/libgtk-x11-2.0.so.0.1000.14)
> ==5425==    by 0x4147503: gtk_init (in
> /usr/lib/libgtk-x11-2.0.so.0.1000.14)
> ==5425==  Address 0x44088C4 is 340 bytes inside a block of size 16,384
> alloc'd
> ==5425==    at 0x4004824: calloc (vg_replace_malloc.c:279)
> ==5425==    by 0x84C486: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
> ==5425==    by 0xAF4501: gdk_display_open (in
> /usr/lib/libgdk-x11-2.0.so.0.1000.14)
> ==5425==    by 0xAD1D7E: gdk_display_open_default_libgtk_only (in
> /usr/lib/libgdk-x11-2.0.so.0.1000.14)
> ==5425==    by 0x41474CE: gtk_init_check (in
> /usr/lib/libgtk-x11-2.0.so.0.1000.14)
> ==5425==    by 0x4147503: gtk_init (in
> /usr/lib/libgtk-x11-2.0.so.0.1000.14)
> ==5425==    by 0x804887F: main (simple.c:45)
>


Then a lot of other errors / warnings when I press the "hello world" button,
and finally the summary:

==5359== LEAK SUMMARY:
> ==5359==    definitely lost: 5,462 bytes in 34 blocks.
> ==5359==    indirectly lost: 9,328 bytes in 460 blocks.
> ==5359==      possibly lost: 56,300 bytes in 63 blocks.
> ==5359==    still reachable: 946,760 bytes in 6,076 blocks.
> ==5359==         suppressed: 0 bytes in 0 blocks.
> ==5359== Reachable blocks (those to which a pointer was found) are not
> shown.
> ==5359== To see them, rerun with: --leak-check=full --show-reachable=yes
>

Can anybody explain me where is the problem? Is it the application, valgrind
or libraries?

Begining of the main():

> int main( int   argc,
>           char *argv[] )
> {
>     /* GtkWidget is the storage type for widgets */
>     GtkWidget *window;
>     GtkWidget *button;
>
>     /* This is called in all GTK applications. Arguments are parsed
>      * from the command line and are returned to the application. */
>     gtk_init (&argc, &argv);
> ...
>

Line 45 simple.c) is the last one above - gtk_init(...).


Best regards,
LUK
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to