summaryrefslogtreecommitdiff
path: root/src/mongo/SConscript
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2019-02-08 17:22:52 -0500
committerHenrik Edin <henrik.edin@mongodb.com>2019-03-12 15:21:32 -0400
commitafe082642124dbda2367cb51c3d748873df9bf7b (patch)
tree0a795f2b3fc17e468c4b923357e6e803e85d818c /src/mongo/SConscript
parentc7e6cd6803e584a6951469e74af93ec3a7a47148 (diff)
downloadmongo-afe082642124dbda2367cb51c3d748873df9bf7b.tar.gz
SERVER-36243 Use sized deallocation.
Added mongoFree to be used when allocating memory with mongoMalloc. It has an overload taking size utilizing tc_free_sized if built with tcmalloc.
Diffstat (limited to 'src/mongo/SConscript')
-rw-r--r--src/mongo/SConscript21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 39b12a203b3..b295b98d9d2 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -48,10 +48,29 @@ env.SConscript(
],
)
+allocatorEnv = env.Clone()
+if allocatorEnv['MONGO_ALLOCATOR'] == 'tcmalloc':
+ allocatorEnv.Append(
+ CPPDEFINES=[
+ 'MONGO_USE_GPERFTOOLS_TCMALLOC',
+ ]
+ )
+
+ if not use_system_version_of_library('tcmalloc'):
+ # Add in the include path for our vendored tcmalloc.
+ allocatorEnv.InjectThirdParty('gperftools')
+
+ # If our changes to tcmalloc are ever upstreamed, this should become set based on a top
+ # level configure check, though its effects should still be scoped just to these files.
+
+ if not use_system_version_of_library('valgrind'):
+ # Include valgrind since tcmalloc disables itself while running under valgrind
+ allocatorEnv.InjectThirdParty('valgrind')
+
# NOTE: This library does not really belong here. Its presence here is
# temporary. Do not add to this library, do not remove from it, and do
# not declare other libraries in this file.
-env.Library(
+allocatorEnv.Library(
target='base',
source=[
'base/data_range.cpp',