mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
SERVER-1517 Add --heapcheck options to build
This commit is contained in:
parent
c629c8e2c2
commit
011e22c064
29
SConstruct
29
SConstruct
@ -260,6 +260,13 @@ AddOption( "--pch",
|
||||
action="store",
|
||||
help="use precompiled headers to speed up the build (experimental)" )
|
||||
|
||||
AddOption( "--heapcheck",
|
||||
dest="heapcheck",
|
||||
type="string",
|
||||
nargs=0,
|
||||
action="store",
|
||||
help="link to heap-checking malloc-lib and look for memory leaks during tests")
|
||||
|
||||
# --- environment setup ---
|
||||
|
||||
def removeIfInList( lst , thing ):
|
||||
@ -1042,6 +1049,28 @@ def doConfigure( myenv , needPcre=True , shell=False ):
|
||||
if not found:
|
||||
raise "can't find a static %s" % l
|
||||
|
||||
# 'tcmalloc' needs to be the last library linked. Please, add new libraries before this
|
||||
# point.
|
||||
if ( GetOption( "heapcheck" ) is not None ) and ( not shell ):
|
||||
if ( not debugBuild ) and ( not debugLogging ):
|
||||
print( "--heapcheck needs --d or --dd" )
|
||||
Exit( 1 )
|
||||
|
||||
if not conf.CheckCXXHeader( "google/heap-checker.h" ):
|
||||
print( "--heapcheck neads header 'google/heap-checker.h'" )
|
||||
Exit( 1 )
|
||||
|
||||
myCheckLib( "tcmalloc" , True ); # if successful, appedded 'tcmalloc' to myenv[ LIBS ]
|
||||
myenv.Append( CPPDEFINES=[ "HEAP_CHECKING" ] )
|
||||
myenv.Append( CPPFLAGS="-fno-omit-frame-pointer" )
|
||||
|
||||
# FIXME doConfigure() is being called twice, in the case of the shell. So if it is called
|
||||
# with shell==True, it'd be on its second call and it would need to rearrange the libraries'
|
||||
# order. The following removes tcmalloc from the LIB's list and reinserts it at the end.
|
||||
if ( GetOption( "heapcheck" ) is not None ) and ( shell ):
|
||||
removeIfInList( myenv["LIBS"] , "tcmalloc" )
|
||||
myenv.Append( LIBS="tcmalloc" )
|
||||
|
||||
myenv.Append(LINKCOM=" $STATICFILES")
|
||||
myenv.Append(STATICFILES=staticlibfiles)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user