Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress LeakSanitizer report when running under -fsanitize=address?

When I compile my C++ code with -fsanitize=address, my software prints out a list of leaks at the time it exits. Is there a way to avoid the leaks report (I'm only interested in memory corruptions, not leaks)? I went to the page with ASAN flags page, but it doesn't look like any of those flags is a match.

like image 399
Alexis Wilke Avatar asked Jun 27 '18 10:06

Alexis Wilke


1 Answers

You can run with export ASAN_OPTIONS=detect_leaks=0 or add a function to your application:

const char* __asan_default_options() { return "detect_leaks=0"; }

See Flags wiki for more details.

like image 102
yugr Avatar answered Sep 28 '22 08:09

yugr