From 09778704b9d7f8fb8b0d1ab170e2cf502387b78b Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Thu, 3 Oct 2013 09:59:15 -0400 Subject: SERVER-11010 For non-debug builds, build gperftools with NDEBUG to prefer the sbrk allocator --- src/third_party/gperftools-2.0/SConscript | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/third_party') diff --git a/src/third_party/gperftools-2.0/SConscript b/src/third_party/gperftools-2.0/SConscript index 084c10b4953..dcf596a9d09 100644 --- a/src/third_party/gperftools-2.0/SConscript +++ b/src/third_party/gperftools-2.0/SConscript @@ -2,6 +2,7 @@ Import("env") Import("has_option") +Import("debugBuild") files = [ 'src/base/dynamic_annotations.c', @@ -56,7 +57,16 @@ conf.CheckMallocHookVolatile() env = conf.Finish() -env.Append( CPPDEFINES=["NO_TCMALLOC_SAMPLES","NO_TCMALLOC_SAMPLES","NO_HEAP_CHECK"] ) +env.Append( CPPDEFINES=[ "NO_TCMALLOC_SAMPLES", "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. +if not debugBuild: + env.AppendUnique( CPPDEFINES=["NDEBUG"] ) + env.Prepend( CPPPATH=["src/"] ) my_SYSLIBDEPS = [] -- cgit v1.2.1