From 79fa35d0ec21d817b398a89e4739294c78c32cd9 Mon Sep 17 00:00:00 2001 From: dhewg Date: Sun, 8 Jan 2012 11:50:42 +0100 Subject: [PATCH] Get rid of ID_MCHECK mcheck() is not thread safe, use MALLOC_CHECK_ or TCMalloc instead. --- neo/CMakeLists.txt | 1 - neo/SConstruct | 21 ++------------------- neo/sys/linux/main.cpp | 34 ---------------------------------- 3 files changed, 2 insertions(+), 54 deletions(-) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index bc53bece..05d21895 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -19,7 +19,6 @@ cmake_minimum_required(VERSION 2.6) # DEBUG_MEMORY -DID_DEBUG_MEMORY', '-DID_REDIRECT_NEWDELETE # LIBC_MALLOC -DUSE_LIBC_MALLOC=0 # ID_NOLANADDRESS -DID_NOLANADDRESS -# ID_MCHECK -DID_MCHECK set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sys/cmake") set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE) diff --git a/neo/SConstruct b/neo/SConstruct index 1de57e6e..95add8e6 100644 --- a/neo/SConstruct +++ b/neo/SConstruct @@ -13,7 +13,7 @@ conf_filename='site.conf' # choose configuration variables which should be saved between runs # ( we handle all those as strings ) serialized=['CC', 'CXX', 'X86', 'BUILD', 'IDNET_HOST', 'DEDICATED', - 'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK', + 'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'TARGET_CORE', 'TARGET_GAME', 'TARGET_D3XP', 'TARGET_MONO', 'TARGET_DEMO', 'NOCURL', 'BUILD_ROOT', 'BUILD_GAMEPAK', 'BASEFLAGS' ] @@ -102,13 +102,6 @@ ID_NOLANADDRESS (default 0) Don't recognize any IP as LAN address. This is useful when debugging network code where LAN / not LAN influences application behaviour -ID_MCHECK (default 2) - Perform heap consistency checking - 0: on in Debug / off in Release - 1 forces on, 2 forces off - note that Doom has it's own block allocator/checking - this should not be considered a replacement, but an additional tool - SETUP (default 0, not saved) build a setup. implies release build @@ -171,7 +164,6 @@ IDNET_HOST = '' DEBUG_MEMORY = '0' LIBC_MALLOC = '1' ID_NOLANADDRESS = '0' -ID_MCHECK = '2' BUILD_ROOT = 'build' SETUP = '0' SDK = '0' @@ -297,12 +289,8 @@ if ( g_sdk or SDK != '0' ): if ( BUILD == 'debug-all' ): OPTCPPFLAGS = [ '-g', '-D_DEBUG' ] - if ( ID_MCHECK == '0' ): - ID_MCHECK = '1' elif ( BUILD == 'debug' ): OPTCPPFLAGS = [ '-g', '-O1', '-D_DEBUG' ] - if ( ID_MCHECK == '0' ): - ID_MCHECK = '1' elif ( BUILD == 'release' ): # -fomit-frame-pointer: "-O also turns on -fomit-frame-pointer on machines where doing so does not interfere with debugging." # on x86 have to set it explicitely @@ -313,8 +301,6 @@ elif ( BUILD == 'release' ): if (g_cpu == 'x86'): OPTCPPFLAGS.append('-march=pentium3') - if ( ID_MCHECK == '0' ): - ID_MCHECK = '2' else: print 'Unknown build configuration ' + BUILD sys.exit(0) @@ -331,9 +317,6 @@ if ( len( IDNET_HOST ) ): if ( ID_NOLANADDRESS != '0' ): CORECPPFLAGS.append( '-DID_NOLANADDRESS' ) -if ( ID_MCHECK == '1' ): - BASECPPFLAGS.append( '-DID_MCHECK' ) - # TODO fix these warnings BASECPPFLAGS.append('-Wno-sign-compare') BASECPPFLAGS.append('-Wno-switch') @@ -377,7 +360,7 @@ local_idlibpic = 0 # switch between base game build and d3xp game build local_d3xp = 0 -GLOBALS = 'g_env g_env_noopt g_game_env g_os g_cpu g_build ID_MCHECK idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp OPTCPPFLAGS' +GLOBALS = 'g_env g_env_noopt g_game_env g_os g_cpu g_build idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp OPTCPPFLAGS' # end general configuration ---------------------- diff --git a/neo/sys/linux/main.cpp b/neo/sys/linux/main.cpp index 2558d492..d1cfe60f 100644 --- a/neo/sys/linux/main.cpp +++ b/neo/sys/linux/main.cpp @@ -32,10 +32,6 @@ If you have questions concerning this license or the applicable additional terms #include #include -#ifdef ID_MCHECK -#include -#endif - #include #include "sys/platform.h" @@ -283,42 +279,12 @@ void idSysLocal::OpenURL( const char *url, bool quit ) { sys->StartProcess( cmdline, quit ); } -/* -=============== -mem consistency stuff -=============== -*/ - -#ifdef ID_MCHECK - -const char *mcheckstrings[] = { - "MCHECK_DISABLED", - "MCHECK_OK", - "MCHECK_FREE", // block freed twice - "MCHECK_HEAD", // memory before the block was clobbered - "MCHECK_TAIL" // memory after the block was clobbered -}; - -void abrt_func( mcheck_status status ) { - Sys_Printf( "memory consistency failure: %s\n", mcheckstrings[ status + 1 ] ); - Posix_SetExit( EXIT_FAILURE ); - common->Quit(); -} - -#endif - /* =============== main =============== */ int main(int argc, char **argv) { -#ifdef ID_MCHECK - // must have -lmcheck linkage - mcheck( abrt_func ); - Sys_Printf( "memory consistency checking enabled\n" ); -#endif - Posix_EarlyInit( ); if ( argc > 1 ) {