|
From: Massimiliano C. <mas...@po...> - 2012-09-26 10:10:03
|
I have a little program that use gdbus binding. I run valgrind with this command line: G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --suppressions=/home/ubuntu/gtk.suppression ./my-dbus-program G_SLICE and G_DEBUG helps to cut down reported errors, but some errors are still reported It seems that they are not in my code: ------------------------8<----------------------------------------------- ==4613== HEAP SUMMARY: ==4613== in use at exit: 61,489 bytes in 1,063 blocks ==4613== total heap usage: 246,982 allocs, 245,919 frees, 8,866,890 bytes allocated ==4613== ==4613== 4 bytes in 1 blocks are possibly lost in loss record 23 of 695 ==4613== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==4613== by 0x402C007: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==4613== by 0x4240762: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.3) ==4613== by 0x4240F18: g_realloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.3) ==4613== by 0x42411FA: g_realloc_n (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.3) ==4613== by 0x41CDAC9: ??? (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== by 0x41CE240: ??? (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== by 0x41D302C: g_type_register_static (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== by 0x41DDDEB: g_pointer_type_register_static (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== by 0x41DDE5F: g_gtype_get_type (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== by 0x41C002F: ??? (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== ==4613== 8 bytes in 1 blocks are possibly lost in loss record 196 of 695 ==4613== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==4613== by 0x402C007: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==4613== by 0x4240762: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.3) ==4613== by 0x4240F18: g_realloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.3) ==4613== by 0x42411FA: g_realloc_n (in /lib/i386-linux-gnu/libglib-2.0.so.0.3200.3) ==4613== by 0x41CEBC9: ??? (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== by 0x41D37CE: g_type_register_fundamental (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== by 0x41BCE1F: ??? (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.3200.3) ==4613== [...] ==4613== ==4613== LEAK SUMMARY: ==4613== definitely lost: 0 bytes in 0 blocks ==4613== indirectly lost: 0 bytes in 0 blocks ==4613== possibly lost: 3,504 bytes in 124 blocks ==4613== still reachable: 57,985 bytes in 939 blocks ==4613== suppressed: 0 bytes in 0 blocks ==4613== Reachable blocks (those to which a pointer was found) are not shown. ==4613== To see them, rerun with: --leak-check=full --show-reachable=yes ==4613== ==4613== For counts of detected and suppressed errors, rerun with: -v ==4613== ERROR SUMMARY: 48 errors from 48 contexts (suppressed: 0 from 0) ------------------------8<----------------------------------------------- how can I suppress errors that do not come from my code? thanks |
|
From: John R. <jr...@bi...> - 2012-09-26 15:59:48
|
> how can I suppress errors that do not come from my code?
If anyone can write a program to answer that question correctly
(no false positives, and no false negatives), then that person
would win the Turing award.
Seriously, "not from my code" is a _very_ deep question.
Figuring out which code is to blame often takes careful analysis.
In a fair number of cases, "both" sides ("your" code
_and_ "the library's" code) are to blame.
Of course, it is easy to suppress any particular error
(identified by kind and traceback). See the output from
$ valgrind --help | grep suppress
and then go back to read the full --help and/or the manual.
A very general suppression could be written to ignore
all errors whose traceback contains any particular subroutine,
but usually this is not a good idea because it is too coarse.
--
|