From 79631667e6a9371c0a664898256c863afa0f7dd7 Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Sat, 17 Dec 2016 22:59:58 -0500 Subject: SERVER-27451 Allow tcmalloc stack sample capture in debug builds --- src/third_party/gperftools-2.5/SConscript | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/third_party/gperftools-2.5/SConscript b/src/third_party/gperftools-2.5/SConscript index f18a43a8ad9..e2696c7d545 100644 --- a/src/third_party/gperftools-2.5/SConscript +++ b/src/third_party/gperftools-2.5/SConscript @@ -84,15 +84,21 @@ env = conf.Finish() env.Append(CPPPATH=["build_" + env["TARGET_OS"] + "_" + env["TARGET_ARCH"]]) -env.Append( CPPDEFINES=[ "NO_TCMALLOC_SAMPLES", "NO_HEAP_CHECK"] ) +env.Append( + CPPDEFINES=["NO_HEAP_CHECK"], +) # The build system doesn't define NDEBUG globally for historical reasons, however, TCMalloc # expects that NDEBUG is used to select between preferring the mmap or the sbrk allocator. For # non-debug builds, we want to prefer the sbrk allocator since this is TCMallocs preferred # production deployment configuration. See the use of NDEBUG and kDebugMode in # src/system-alloc.cc for more details. +# +# Additionally, for debug builds we do want to capture stacks during (de)allocations, but we don't +# want to pay that cost for release builds. For non-debug builds we use NO_TCMALLOC_SAMPLES to +# disable the stack trace collection. if not debugBuild: - env.Append( CPPDEFINES=["NDEBUG"] ) + env.Append( CPPDEFINES=["NDEBUG", "NO_TCMALLOC_SAMPLES"] ) env.Prepend( CPPPATH=["src/"] ) -- cgit v1.2.1