leak-sanitizer

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

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

我的梦境 提交于 2020-04-11 18:11:10
问题 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

How can I know if Leak Sanitizer is enabled at compile time?

点点圈 提交于 2019-12-23 15:51:06
问题 The GCC and Clang compilers both have support for LeakSanitizer which helps finding memory leaks in C programs. Sometimes a memory leak is unavoidable (because it is being tested in a test suite for example). Such memory can be annotated using the Leak Sanitizer interface: #include <sanitizer/lsan_interface.h> void *p = create_new_object(); __lsan_ignore_object(p); This will however break on compilers that do not support LSan. In Address Sanitizer, this construct can be used to detect the

What is the difference between a direct and indirect leak?

限于喜欢 提交于 2019-12-10 13:18:53
问题 I got the following output from the LeakSanitizer tool. What is the difference between a direct and indirect leak, as the tool understands it? 13: ==29107==ERROR: LeakSanitizer: detected memory leaks 13: 13: Direct leak of 288 byte(s) in 6 object(s) allocated from: 13: #0 0x7f2ce0089050 in __interceptor_malloc (/nix/store/zahs1kwq4742f6l6h7yy4mdj44zzc1kd-gcc-7-20170409-lib/lib/libasan.so+0xd9050) 13: #1 0x7f2cdfb974fe in qdr_core_subscribe ../src/router_core/route_tables.c:149 13: #2