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

浪尽此生 提交于 2020-04-11 18:12:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!