问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/51060801/how-to-suppress-leaksanitizer-report-when-running-under-fsanitize-address