Search code examples
c++address-sanitizerleak-sanitizer

Suppress LeakSanitizer output


How can I suppress LeakSanitizer outputs?

For Address Sanitizer, I can use __attribute__((no_sanitize_address)) How to suppress LeakSanitizer report when running under -fsanitize=address? But it doesn't work for LS.

__attribute__((no_sanitize_address))
std::shared_ptr make_module()
{
  return std::shared_ptr(new client);
}
  21 Indirect leak of 3670536 byte(s) in 1 object(s) allocated from:
  22     #0 0x7fbf42f521a8 in operator new(unsigned long) (/lib64/libasan.so.4+0xe01a8)
  23     #1 0x7106b2 in graphite::make_module() /client.cc:15

Solution

  • Try running with export LSAN_OPTIONS=detect_leaks=0. For a more fine-tuned control use LSAN_OPTIONS=suppressions interface (described e.g. here).