[PATCH] D35443: Enable 64-bit Darwin LeakSanitizer by default on AddressSanitizer builds

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 16:17:18 PDT 2017


fjricci created this revision.

LSan on Darwin was originally disabled by default for a couple reasons:

1. To give the opportunity to test thoroughly
2. The performance wasn't great

In terms of the first item, I've been running LSan on a large internal project
(10s of thousands of files of c++ and objc) for about a month and things are working well,
the full test suite for the project runs and passes with LSan enabled on Darwin.

The performance issues have been largely mitigated, and the slowdown over stock ASan
is similar to Linux (10-15% on the tests I've looked at).


https://reviews.llvm.org/D35443

Files:
  lib/sanitizer_common/sanitizer_flags.inc
  test/asan/lit.cfg


Index: test/asan/lit.cfg
===================================================================
--- test/asan/lit.cfg
+++ test/asan/lit.cfg
@@ -38,11 +38,6 @@
   # Also, make sure we do not overwhelm the syslog while testing.
   default_asan_opts = 'abort_on_error=0'
   default_asan_opts += ':log_to_syslog=0'
-
-  # On Darwin, leak checking is not enabled by default. Enable for x86_64
-  # tests to prevent regressions
-  if config.target_arch == 'x86_64':
-    default_asan_opts += ':detect_leaks=1'
 elif config.android:
   # The same as on Darwin, we default to "abort_on_error=1" which slows down
   # testing. Also, all existing tests are using "not" instead of "not --crash"
Index: lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- lib/sanitizer_common/sanitizer_flags.inc
+++ lib/sanitizer_common/sanitizer_flags.inc
@@ -62,7 +62,8 @@
 COMMON_FLAG(
     int, verbosity, 0,
     "Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).")
-COMMON_FLAG(bool, detect_leaks, !SANITIZER_MAC, "Enable memory leak detection.")
+COMMON_FLAG(bool, detect_leaks, !(SANITIZER_MAC && (SANITIZER_WORDSIZE != 64)),
+            "Enable memory leak detection.")
 COMMON_FLAG(
     bool, leak_check_at_exit, true,
     "Invoke leak checking in an atexit handler. Has no effect if "


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35443.106729.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170714/9a8cdcd4/attachment.bin>


More information about the llvm-commits mailing list