memory leak



Hi
I'm new to gtkmm and perhaps i'm doing something wrong.
I'm using gtkmm 2.4 on fedora6.

Now i take the little example application simple.cpp

#include <gtkmm.h>

int main(int argc, char *argv[]) {
   Gtk::Main kit(argc, argv);
   Gtk::Window window;
   Gtk::Main::run(window);
   return 0;
}

and compile it:

g++  -g simple.cpp -o simple `pkg-config gtkmm-2.4 --cflags --libs`

Then valgrind (v 3.2.1)

valgrind --tool=memcheck --leak-check=yes  --show-reachable=yes -v ./simple

gives an error about an unitialized variable :
==5048== Syscall param writev(vector[...]) points to uninitialised byte(s)
==5048==    at 0x44FAAE8: writev (in /lib/libc-2.5.so)
==5048==    by 0x55FD98D: (within /usr/lib/libX11.so.6.2.0)
==5048==    by 0x55FD77E: _X11TransWritev (in /usr/lib/libX11.so.6.2.0)
==5048==    by 0x5603468: _XSend (in /usr/lib/libX11.so.6.2.0)
==5048==    by 0x55F438A: XQueryExtension (in /usr/lib/libX11.so.6.2.0)
==5048==    by 0x55E8CAA: XInitExtension (in /usr/lib/libX11.so.6.2.0)
==5048==    by 0x5C2ECFF: XFixesFindDisplay (in /usr/lib/libXfixes.so.3.1.0)
==5048==    by 0x5C2EFCC: XFixesQueryExtension (in /usr/lib/libXfixes.so.3.1.0)
==5048==    by 0x582C704: gdk_display_open (in
/usr/lib/libgdk-x11-2.0.so.0.1000.13)
==5048==    by 0x5809D5E: gdk_display_open_default_libgtk_only (in
/usr/lib/libgdk-x11-2.0.so.0.1000.13)
==5048==    by 0x59BA65E: gtk_init_check (in
/usr/lib/libgtk-x11-2.0.so.0.1000.13)
==5048==    by 0x59BA693: gtk_init (in /usr/lib/libgtk-x11-2.0.so.0.1000.13)
==5048==  Address 0x45C5CB4 is 324 bytes inside a block of size 16,384 alloc'd
==5048==    at 0x400473F: calloc (vg_replace_malloc.c:279)
==5048==    by 0x55EE406: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
==5048==    by 0x582C551: gdk_display_open (in
/usr/lib/libgdk-x11-2.0.so.0.1000.13)
==5048==    by 0x5809D5E: gdk_display_open_default_libgtk_only (in
/usr/lib/libgdk-x11-2.0.so.0.1000.13)
==5048==    by 0x59BA65E: gtk_init_check (in
/usr/lib/libgtk-x11-2.0.so.0.1000.13)
==5048==    by 0x59BA693: gtk_init (in /usr/lib/libgtk-x11-2.0.so.0.1000.13)
==5048==    by 0x41C2AF6: Gtk::Main::init(int*, char***, bool) (in
/usr/lib/libgtkmm-2.4.so.1.0.30)
==5048==    by 0x41C2C7B: Gtk::Main::Main(int&, char**&, bool) (in
/usr/lib/libgtkmm-2.4.so.1.0.30)
==5048==    by 0x8048ADD: main (simple.cpp:6)
-
and a lot of leaks:
==5048== LEAK SUMMARY:
==5048==    definitely lost: 0 bytes in 0 blocks.
==5048==      possibly lost: 49,424 bytes in 54 blocks.
==5048==    still reachable: 237,710 bytes in 4,803 blocks.
==5048==         suppressed: 0 bytes in 0 blocks.

(the valgrind output is quite long, so i don't attach it,
but i can send it if required))

How can i prevent these leaks?
Is there some sort of finalize-call to clean up?
What is the meaning of the uninitialized variable error?

Thank You
 Jody



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