在-fsanitize = address下运行时,如何隐藏LeakSanitizer报告? [英] How to suppress LeakSanitizer report when running under -fsanitize=address?

查看:531
本文介绍了在-fsanitize = address下运行时,如何隐藏LeakSanitizer报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 -fsanitize = address 编译C ++代码时,我的软件在退出时会打印出泄漏列表。有没有办法避免泄漏报告(我只对内存损坏感兴趣,而对泄漏不感兴趣)?我进入了 ASAN标志页面的页面,但是

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.

推荐答案

您可以使用 export ASAN_OPTIONS运行= detect_leaks = 0 或向您的应用程序添加函数:

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"; }

请参见标志Wiki 了解更多详情。

这篇关于在-fsanitize = address下运行时,如何隐藏LeakSanitizer报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆