From 41b6918f1cfb61d3524f84d7b40fbda18c1242c0 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 4 Oct 2019 15:51:22 -0700 Subject: [PATCH] Wire up the standalone leak sanitizer. (#320) By default, address sanitizer enabled builds can detect leaks if the `ASAN_OPTIONS=detect_leaks=1` environment option is specified. If only leaks need to detected, this standalong option may be used. --- build/config/BUILD.gn | 8 +------- build/config/allocator.gni | 10 +--------- build/config/compiler/BUILD.gn | 1 + 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index 17c40e20214..3810a9ac548 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -43,17 +43,11 @@ config("feature_flags") { if (use_nss_certs) { defines += [ "USE_NSS_CERTS=1" ] } - if (use_allocator != "tcmalloc") { - defines += [ "NO_TCMALLOC" ] - } if (is_asan) { defines += [ "ADDRESS_SANITIZER" ] } if (is_lsan) { - defines += [ - "LEAK_SANITIZER", - "WTF_USE_LEAK_SANITIZER=1", - ] + defines += [ "LEAK_SANITIZER" ] } if (is_tsan) { defines += [ diff --git a/build/config/allocator.gni b/build/config/allocator.gni index 71418a8e772..45aa146c27f 100644 --- a/build/config/allocator.gni +++ b/build/config/allocator.gni @@ -2,15 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# TODO(GYP): Make tcmalloc work on win. -if (is_android || current_cpu == "mipsel" || is_mac || is_ios || is_asan || - is_lsan || is_tsan || is_msan || is_win) { - _default_allocator = "none" -} else { - _default_allocator = "tcmalloc" -} - declare_args() { # Memory allocator to use. Set to "none" to use default allocator. - use_allocator = _default_allocator + use_allocator = "none" } diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index a79ca201c53..0ff77a32928 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -120,6 +120,7 @@ config("compiler") { } if (is_lsan) { cflags += [ "-fsanitize=leak" ] + ldflags += [ "-fsanitize=leak" ] } if (is_tsan) { cflags += [ "-fsanitize=thread" ]