Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Favorite Valgrind Options [closed]

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?

like image 965
neversaint Avatar asked Mar 13 '09 07:03

neversaint


People also ask

Is Valgrind ever wrong?

Yes, there are false positives with Valgrind, that's why it has suppression files for particular glibc and gcc versions, for example.

What are the problems with Valgrind?

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.

How much slower is Valgrind?

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.


2 Answers

SVN valgrind has --track-origins=yes, which actually makes uninitialized value warnings useful.

like image 50
alex strange Avatar answered Oct 14 '22 22:10

alex strange


--tool=callgrind

And when applicable, --instr-atstart=no

like image 45
John Zwinck Avatar answered Oct 14 '22 22:10

John Zwinck