Всем привет. Пишем простейшее приложение на GTK+: #include <gtk/gtk.h> int main (int argc, char *argv[]) { GtkWidget *window; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show (window); gtk_main (); return 0; } Собираем: gcc -g -O0 -Wall -pedantic `pkg-config --cflags --libs gtk+-2.0` main.c -o main Натравливаем на него valgrind: Invalid read of size 4 ==26978== at 0x4015209: (within /lib/ld-2.7.so) ==26978== by 0x4005C69: (within /lib/ld-2.7.so) ==26978== by 0x4007A97: (within /lib/ld-2.7.so) ==26978== by 0x4011543: (within /lib/ld-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x4010F5D: (within /lib/ld-2.7.so) ==26978== by 0x4731291: (within /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x4731454: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x470B186: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x470B29F: (within /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x470D075: __nss_passwd_lookup (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== Address 0x4bc8284 is 36 bytes inside a block of size 38 alloc'd ==26978== at 0x4022AB8: malloc (vg_replace_malloc.c:207) ==26978== by 0x4008031: (within /lib/ld-2.7.so) ==26978== by 0x4011543: (within /lib/ld-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x4010F5D: (within /lib/ld-2.7.so) ==26978== by 0x4731291: (within /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x4731454: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x470B186: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x470B29F: (within /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x470D075: __nss_passwd_lookup (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x46B7B72: getpwnam_r (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== ==26978== Invalid read of size 4 ==26978== at 0x4015237: (within /lib/ld-2.7.so) ==26978== by 0x4005C69: (within /lib/ld-2.7.so) ==26978== by 0x4007A97: (within /lib/ld-2.7.so) ==26978== by 0x400BC16: (within /lib/ld-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x400BDF9: (within /lib/ld-2.7.so) ==26978== by 0x40115A3: (within /lib/ld-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x4010F5D: (within /lib/ld-2.7.so) ==26978== by 0x4731291: (within /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x4731454: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== Address 0x4bc85cc is 28 bytes inside a block of size 31 alloc'd ==26978== at 0x4022AB8: malloc (vg_replace_malloc.c:207) ==26978== by 0x4008031: (within /lib/ld-2.7.so) ==26978== by 0x400BC16: (within /lib/ld-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x400BDF9: (within /lib/ld-2.7.so) ==26978== by 0x40115A3: (within /lib/ld-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x4010F5D: (within /lib/ld-2.7.so) ==26978== by 0x4731291: (within /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x400D5D5: (within /lib/ld-2.7.so) ==26978== by 0x4731454: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.7.so) ==26978== by 0x470B186: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.7.so) -- и ещё много похожих ругательств -- ==27164== ERROR SUMMARY: 10 errors from 9 contexts (suppressed: 99 from 1) ==27164== malloc/free: in use at exit: 253,147 bytes in 3,181 blocks. ==27164== malloc/free: 10,472 allocs, 7,291 frees, 706,786 bytes allocated. ==27164== For counts of detected errors, rerun with: -v ==27164== searching for pointers to 3,181 not-freed blocks. ==27164== checked 582,764 bytes. Откуда столько ошибок? Development branch?
Ответ на:
комментарий
от Legioner
Ответ на:
комментарий
от Bohtvaroh
Ответ на:
комментарий
от Legioner
Ответ на:
комментарий
от Bohtvaroh
Ответ на:
комментарий
от cathode
Ответ на:
комментарий
от Bohtvaroh
Ответ на:
комментарий
от cathode
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.
Похожие темы
- Форум как локализовать memory leak через valgrind? (2006)
- Форум valgrind and pthread (2005)
- Форум valgrind - Address 0x5c191c0 is 0 bytes after a block of size 786,432 alloc'd (2011)
- Форум gcc/g++ - включить добавление номеров строк в .o/.so/.elf (2010)
- Форум Free-sa (ошибка при создании отчёта) (2014)
- Форум c, glib, memory leak? (2009)
- Форум [C] malloc (2010)
- Форум glibc-2.3.3 (2004)
- Форум Valgrind в деле. Что, как? (2018)
- Форум C/C++, помогите разобраться с утечками (2016)