Reputation: 700
I want suppress Valgrind's reporting of some "definitely lost" memory by the library I'm using. I have tried valgrind --gen-suppressions=yes ./a
but it only prompts for errors such as "conditional jump or move depends on uninitialized value".
Is there a way to generate suppressions for straight-up memory leaks? If not, is it difficult to write them by hand? Valgrind's manpage seems to discourage it, at least for errors.
Upvotes: 9
Views: 14805
Reputation: 5657
There is a page on how you can generate such a file based on your errors https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto
It's not perfect, but you can start from it
Upvotes: 1
Reputation: 3381
Run valgrind with the --gen-suppressions=all
and --log-file=memcheck.log
options, and manually copy/paste the logged suppressions into the suppression file.
valgrind --leak-check=full --gen-suppressions=all --log-file=memcheck.log ./a
If you find the output is mixed with the application output then redirect valigrind output to separate file descriptor: --log-fd=9 9>>memcheck.log
valgrind --leak-check=full --gen-suppressions=all --log-fd=9 ./a 9>>memcheck.log
Upvotes: 10
Reputation: 10262
You can write a suppression file of your own (but it doesn't seem obvious) :
--suppressions=<filename> [default: $PREFIX/lib/valgrind/default.supp]
If the question was to disable an entire library, see this.
Valgrind's man page.
Upvotes: -2
Reputation: 700
To be prompted for leaks that aren't generating errors, you have to run
valgrind --leak-check=full --gen-suppressions=yes ./a
Upvotes: 4