I'm running valgrind with following setup:
valgrind --tool=memcheck --tool=callgrind --num-callers=20 --track-fds=yes --error-exitcode=1 CMD
. Especially,--track-fds=yes
work as desired, but every run fails due to fds 0,1,2 which are supposed to be open. However, I don't want to drop --track-fds
, as it certainly gives meaningful information. So, is there a valgrind option / method to track fds excluding 0,1,2?
==5872== FILE DESCRIPTORS: 3 open at exit.
==5872== Open file descriptor 2:
==5872== <inherited from parent>
==5872==
==5872== Open file descriptor 1:
==5872== <inherited from parent>
==5872==
==5872== Open file descriptor 0: /dev/pts/0
==5872== <inherited from parent>
==5872==
==5872==
==5872== Events : Ir
==5872== Collected : 3081079256
==5872==
==5872== I refs: 3,081,079,256
valgrind is a tool for finding memory access errors to heap memory (memory that is dynamically allocated with new or malloc) in C and C++ programs. Memory access errors are the most difficult bugs to find and to fix.
Valgrind basically acts like a virtual machine or virtual execution environment running the program, watching all variables, memory allocations, etc., etc. and therefore will run quite a bit slower than native code.
By default Valgrind's malloc, realloc, etc, return a block whose starting address is 8-byte aligned or 16-byte aligned (the value depends on the platform and matches the platform default). This option allows you to specify a different alignment.
Those are stdin
, stdout
and stderr
. Typically you can ignore these but if you really want to be fastidious:
fclose( stdin );
fclose( stdout );
fclose( stderr );
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