Skip to content

Commit b49d837

Browse files
committed
CXX-306 TCMalloc is not appropriate for driver library builds
1 parent ed0db2f commit b49d837

File tree

1 file changed

+8
-40
lines changed

1 file changed

+8
-40
lines changed

SConstruct

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,8 @@ add_option( "durableDefaultOff" , "have durable default to off" , 0 , True )
256256
add_option( "pch" , "use precompiled headers to speed up the build (experimental)" , 0 , True , "usePCH" )
257257
add_option( "distcc" , "use distcc for distributing builds" , 0 , False )
258258

259-
# debugging/profiling help
260-
if os.sys.platform.startswith("linux") and (os.uname()[-1] == 'x86_64'):
261-
defaultAllocator = 'tcmalloc'
262-
elif (os.sys.platform == "darwin") and (os.uname()[-1] == 'x86_64'):
263-
defaultAllocator = 'tcmalloc'
264-
else:
265-
defaultAllocator = 'system'
266-
add_option( "allocator" , "allocator to use (tcmalloc or system)" , 1 , True,
267-
default=defaultAllocator )
259+
add_option( "allocator" , "allocator to use (tcmalloc or system)" , 1 , False )
260+
268261
add_option( "gdbserver" , "build in gdb server support" , 0 , True )
269262
add_option( "heapcheck", "link to heap-checking malloc-lib and look for memory leaks during tests" , 0 , False )
270263
add_option( "gcov" , "compile with flags for gcov" , 0 , True )
@@ -1203,13 +1196,6 @@ def doConfigure(myenv):
12031196
if not AddToCXXFLAGSIfSupported(myenv, '-std=c++0x'):
12041197
print( 'C++11 mode requested, but cannot find a flag to enable it' )
12051198
Exit(1)
1206-
# Our current builtin tcmalloc is not compilable in C++11 mode. Remove this
1207-
# check when our builtin release of tcmalloc contains the resolution to
1208-
# http://code.google.com/p/gperftools/issues/detail?id=477.
1209-
if get_option('allocator') == 'tcmalloc':
1210-
if not use_system_version_of_library('tcmalloc'):
1211-
print( 'TCMalloc is not currently compatible with C++11' )
1212-
Exit(1)
12131199

12141200
if not AddToCFLAGSIfSupported(myenv, '-std=c99'):
12151201
print( 'C++11 mode selected for C++ files, but failed to enable C99 for C files' )
@@ -1443,32 +1429,14 @@ def doConfigure(myenv):
14431429
if conf.env['MONGO_HAVE_TIMEGM']:
14441430
conf.env.Append(CPPDEFINES=['MONGO_HAVE_TIMEGM'])
14451431

1446-
# 'tcmalloc' needs to be the last library linked. Please, add new libraries before this
1447-
# point.
1448-
if get_option('allocator') == 'tcmalloc':
1449-
if use_system_version_of_library('tcmalloc'):
1450-
conf.FindSysLibDep("tcmalloc", ["tcmalloc"])
1451-
elif has_option("heapcheck"):
1452-
print ("--heapcheck does not work with the tcmalloc embedded in the mongodb source "
1453-
"tree. Use --use-system-tcmalloc.")
1454-
Exit(1)
1455-
elif get_option('allocator') == 'system':
1456-
pass
1457-
else:
1458-
print "Invalid --allocator parameter: \"%s\"" % get_option('allocator')
1459-
Exit(1)
1460-
1461-
if has_option("heapcheck"):
1462-
if not debugBuild:
1463-
print( "--heapcheck needs --d or --dd" )
1464-
Exit( 1 )
1432+
if has_option('allocator'):
1433+
print("WARNING: --allocator option ignored, not meaningful for driver build")
14651434

1466-
if not conf.CheckCXXHeader( "google/heap-checker.h" ):
1467-
print( "--heapcheck neads header 'google/heap-checker.h'" )
1468-
Exit( 1 )
1435+
if has_option('use-system-tcmalloc'):
1436+
print("WARNING: --use-system-tcmalloc option ignored, not meaningful for driver build")
14691437

1470-
conf.env.Append( CPPDEFINES=[ "HEAP_CHECKING" ] )
1471-
conf.env.Append( CCFLAGS=["-fno-omit-frame-pointer"] )
1438+
if has_option("heapcheck"):
1439+
print("WARNING: --heapcheck ignored, not meaningful for driver build")
14721440

14731441
# ask each module to configure itself and the build environment.
14741442
moduleconfig.configure_modules(mongo_modules, conf)

0 commit comments

Comments
 (0)