For gcc in the -fsanitize option, how to use ‘address’ and ‘leak’ together?

3.7k views Asked by At

gcc ver is 5.4.0

I want to use it like :-fsanitize=address,leak

OK?

1

There are 1 answers

5
Basile Starynkevitch On BEST ANSWER

Just pass both -fsanitize=address and -fsanitize=leak (as separate program arguments) to gcc. Read the chapter on Invoking GCC and the section on Instrumentation Options.

Consider also using the valgrind program.

Don't forget to compile all your code with -Wall -Wextra -g (and perhaps even -g3).