From: Imhexyl I. <im...@gm...> - 2009-03-17 08:23:32
|
I used Memcheck to check a simplest glib program listed below. While I set leak-check flag to summary, the detector showed me 20 blocks possibly lost. Confusing, while I set leak-check flag to yes or full in order to get details of these leaks, the detector showed me 20 blocks suppressed instead of 20 blocks possibly lost, though the number of suppressed errors was not changed. Which report I should belive? What's happened while flag was changed? - The program I checked #include <gio/gio.h> #include <stdio.h> int main() { g_type_init(); return 0; } - I compiled this this program like this gcc empty_glib.c -g -Wall -O0 `pkg-config --cflags --libs gobject-2.0` -o empty_glib - The operations of valgrind and according reports are showed blow 1. G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck --leak-check=yes -v ./empty_glib ... ==7103== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 1) --7103-- --7103-- supp: 17 dl-hack3-1 ==7103== malloc/free: in use at exit: 12,868 bytes in 309 blocks. ==7103== malloc/free: 503 allocs, 194 frees, 187,652 bytes allocated. ==7103== ==7103== searching for pointers to 309 not-freed blocks. ==7103== checked 82,596 bytes. ==7103== ==7103== LEAK SUMMARY: ==7103== definitely lost: 0 bytes in 0 blocks. ==7103== possibly lost: 0 bytes in 0 blocks. ==7103== still reachable: 12,068 bytes in 289 blocks. ==7103== suppressed: 800 bytes in 20 blocks. ... 2. G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck --leak-check=summary -v ./empty_glib ... ==7164== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 1) --7164-- --7164-- supp: 17 dl-hack3-1 ==7164== malloc/free: in use at exit: 12,868 bytes in 309 blocks. ==7164== malloc/free: 503 allocs, 194 frees, 187,652 bytes allocated. ==7164== ==7164== searching for pointers to 309 not-freed blocks. ==7164== checked 82,596 bytes. ==7164== ==7164== LEAK SUMMARY: ==7164== definitely lost: 0 bytes in 0 blocks. ==7164== possibly lost: 800 bytes in 20 blocks. ==7164== still reachable: 12,068 bytes in 289 blocks. ==7164== suppressed: 0 bytes in 0 blocks. ... |