I have following valgrind output:
==28099==
==28099== HEAP SUMMARY:
==28099== in use at exit: 0 bytes in 0 blocks
==28099== total heap usage: 131 allocs, 131 frees, 3,472 bytes allocated
==28099==
==28099== All heap blocks were freed -- no leaks are possible
==28099==
==28099== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
--28099--
--28099-- used_suppression: 2 dl-hack3-cond-1
--28099-- used_suppression: 2 glibc-2.5.x-on-SUSE-10.2-(PPC)-2a
==28099==
==28099== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
There are 4 suppressed error. Although there is no leak here, but creats problem while porting to another system.
[EDIT]
I rerun with the valgrind -v
option too. But I don't find any errors there.
==30287== Memcheck, a memory error detector ==30287== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==30287== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info ==30287== Command: ./EXECUTABLE1 test_input.txt ==30287== --30287-- Valgrind options: --30287-- --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp --30287-- -v --30287-- --gen-suppressions=all --30287-- --error-limit=no --30287-- Contents of /proc/version: --30287-- Linux version 2.6.38.3.2.amd64-smp (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 SMP Wed Apr 20 17:36:19 CEST 2011 --30287-- Arch and hwcaps: AMD64, amd64-sse3-cx16 --30287-- Page sizes: currently 4096, max supported 4096 --30287-- Valgrind library directory: /usr/lib/valgrind --30287-- Reading syms from /home/path/to/file(0x400000) --30287-- Reading syms from /lib/ld-2.11.2.so (0x4000000) --30287-- Considering /lib/ld-2.11.2.so .. --30287-- .. CRC mismatch (computed cd91cee9 wanted 11b4673c) --30287-- Considering /usr/lib/debug/lib/ld-2.11.2.so .. --30287-- .. CRC is valid --30287-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux (0x38000000) --30287-- object doesn't have a dynamic symbol table --30287-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp --30287-- Reading suppressions file: /usr/lib/valgrind/default.supp --30287-- REDIR: 0x4016230 (strlen) redirected to 0x380408a7 (vgPlain_amd64_linux_REDIR_FOR_strlen) --30287-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so (0x4a20000) --30287-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so (0x4c21000) ==30287== WARNING: new redirection conflicts with existing -- ignoring it --30287-- new: 0x04016230 (strlen ) R-> 0x04c25850 strlen --30287-- REDIR: 0x40160a0 (index) redirected to 0x4c25460 (index) --30287-- REDIR: 0x4016120 (strcmp) redirected to 0x4c25e30 (strcmp) --30287-- Reading syms from /lib/libm-2.11.2.so (0x4e29000) --30287-- Considering /lib/libm-2.11.2.so .. --30287-- .. CRC mismatch (computed dd5c85df wanted ccd85fcf) --30287-- Considering /usr/lib/debug/lib/libm-2.11.2.so .. --30287-- .. CRC is valid --30287-- Reading syms from /lib/libc-2.11.2.so (0x50ab000) --30287-- Considering /lib/libc-2.11.2.so .. --30287-- .. CRC mismatch (computed 7d8e8f4f wanted 9b015f2c) --30287-- Considering /usr/lib/debug/lib/libc-2.11.2.so .. --30287-- .. CRC is valid --30287-- REDIR: 0x5128600 (__GI_strrchr) redirected to 0x4c25280 (__GI_strrchr) --30287-- REDIR: 0x51218c0 (malloc) redirected to 0x4c24466 (malloc) --30287-- REDIR: 0x5128d00 (memchr) redirected to 0x4c25ed0 (memchr) --30287-- REDIR: 0x512a750 (memcpy) redirected to 0x4c25f00 (memcpy) --30287-- REDIR: 0x5126b10 (strlen) redirected to 0x4a205ac (_vgnU_ifunc_wrapper) ==30287== WARNING: new redirection conflicts with existing -- ignoring it --30287-- new: 0x05126b40 (__GI_strlen ) R-> 0x04c257f0 strlen --30287-- REDIR: 0x5126b40 (__GI_strlen) redirected to 0x4c25810 (__GI_strlen) --30287-- REDIR: 0x512baf0 (__GI___rawmemchr) redirected to 0x4c26ba0 (__GI___rawmemchr) --30287-- REDIR: 0x51217e0 (free) redirected to 0x4c24076 (free) Following are the keys and their corresponding value present --30287-- REDIR: 0x512bb40 (strchrnul) redirected to 0x4c26b50 (strchrnul)
Look for function names and line numbers If you compile your program with the -g flag, Valgrind will show you the function names and line numbers where errors occur.
Therefore, Valgrind allows you to selectively suppress errors, by recording them in a suppressions file which is read when Valgrind starts up. The build mechanism attempts to select suppressions which give reasonable behaviour for the libc and XFree86 versions detected on your machine.
To run Valgrind, pass the executable as an argument (along with any parameters to the program). The flags are, in short: --leak-check=full : "each individual leak will be shown in detail" --show-leak-kinds=all : Show all of "definite, indirect, possible, reachable" leak kinds in the "full" report.
Start up two terminal windows so that you can interact with Valgrind and GDB simultaneously. In one terminal, run Valgrind with the --vgdb-error=0 option. When running with --vgdb-error= n, Valgrind waits for n errors to occur before pausing and waiting for a connection from GDB.
You can view / modify the suppressed errors in /usr/lib/valgrind/default.supp
.
The suppressed errors are just errors that are system specific, known problems with your libraries. So they are not the right suspects for portability problems to another system.
On x86 hosts valgrind outputs such line:
For counts of detected and suppressed errors, rerun with: -v
So run your prog like this: valgrind -v ./myprog
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With