Valgrind 3.4 suppressions A little HOWTO

I learned the hard way today, that Valgrind gives some false positive memory leak results when using cudaMallocHost(). Inspired by MisterAnderson (see post ) I’ve now begun to use a a suppressions file for readability of the output.

When outputting errors, Valgrind can simultaneously provide you with a suppression rule that you can put in a file (usually named something.supp). This is achieved by, for instance

[codebox]valgrind --gen-suppressions=all --leak-check=full --show-reachable=yes yourExecutable[/codebox]

You can now paste what you want to supress into a file and include it with the next run:

[codebox]valgrind --gen-suppressions=all --leak-check=full --show-reachable=yes --suppressions=cudart.valgrind34.supp yourExecutable[/codebox]

You can then continue to add rules until you have an uncluttered output.

The rules provided by the “–gen-suppressions=all” output are very specific (one rule, one match) but you can make them more generic by using wildcards.

This is easily achieved from

Valgrind 3.4 and upwards as it now supports “frame-level wildcards”. This wildcard (three dots, “…”) matches all objects/functions any number of times. You can read more of it in detail at

Valgrind documentation

I’ve included my own suppression file (CUDA 2.0, Ubuntu 8.10)[attachment=8455:cudart.v…d34.supp.txt] - I had to install valgrind 3.4 separately though, as Ubuntu still has 3.3 in the package system
cudart.valgrind34.supp.txt (1.01 KB)

Nice! thanks