I usually use this:
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./mycode
But not sure if on one hand it checks everything, on the other hand too verbose. What's your favorite option?
Yes, there are false positives with Valgrind, that's why it has suppression files for particular glibc and gcc versions, for example.
Valgrind reports two types of issues: memory errors and memory leaks. When a program dynamically allocates memory and forgets to later free it, it creates a leak. A memory leak generally won't cause a program to misbehave, crash, or give wrong answers, and is not an urgent situation.
A program running under Valgrind could run 20 to 50 times slower than in regular production. This can be a showstopper for CPU-intensive programs.
SVN valgrind has --track-origins=yes, which actually makes uninitialized value warnings useful.
--tool=callgrind
And when applicable, --instr-atstart=no
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