Thursday, 15 January 2015

c - Memory leak in libwnck -



c - Memory leak in libwnck -

i tried compile first illustration of libwnck's introduction:

#include <libwnck/libwnck.h> int main (int argc, char **argv) { wnckscreen *screen; wnckwindow *active_window; glist *window_l; gdk_init (&argc, &argv); screen = wnck_screen_get_default (); wnck_screen_force_update (screen); active_window = wnck_screen_get_active_window (screen); (window_l = wnck_screen_get_windows (screen); window_l != null; window_l = window_l->next) { wnckwindow *window = wnck_window (window_l->data); g_print ("%s%s\n", wnck_window_get_name (window), window == active_window ? " (active)" : ""); } wnck_shutdown(); }

with command line:

gcc -o testwnck testwnck.cpp -dwnck_i_know_this_is_unstable `pkg-config --libs libwnck-3.0` `pkg-config --cflags libwnck-3.0`

but when run through valgrind, many errors appear. instance:

==20365== 96 bytes in 2 blocks perchance lost in loss record 876 of 1,019 ==20365== @ 0x4c28f40: malloc (vg_replace_malloc.c:296) ==20365== 0x6f6e0a0: g_malloc (in /usr/lib64/libglib-2.0.so.0.4200.0) ==20365== 0x6f84bb5: g_memdup (in /usr/lib64/libglib-2.0.so.0.4200.0) ==20365== 0x6cfd364: type_iface_vtable_base_init_wm (in /usr/lib64/libgobject-2.0.so.0.4200.0) ==20365== 0x6cfe5bc: g_type_class_ref (in /usr/lib64/libgobject-2.0.so.0.4200.0) ==20365== 0x6ce79d4: g_object_new_valist (in /usr/lib64/libgobject-2.0.so.0.4200.0) ==20365== 0x6ce7bd3: g_object_new (in /usr/lib64/libgobject-2.0.so.0.4200.0) ==20365== 0x6745e6b: gdk_pixbuf_new_from_data (in /usr/lib64/libgdk_pixbuf-2.0.so.0.3000.8) ==20365== 0x4e60681: scaled_from_pixdata (in /usr/lib64/libwnck-3.so.0.2.2) ==20365== 0x4e62de7: _wnck_read_icons (in /usr/lib64/libwnck-3.so.0.2.2) ==20365== 0x4e57f74: get_icons (in /usr/lib64/libwnck-3.so.0.2.2) ==20365== 0x4e58dc6: force_update_now (in /usr/lib64/libwnck-3.so.0.2.2)

adding phone call wnck_shutdown() before returning main function not help. can suppress these errors?

edit: have tried using gtk suppression file valgrind, still have errors.

c memory-leaks valgrind gnome wnck

No comments:

Post a Comment