diff options
-rw-r--r-- | base/allocator/allocator.gyp | 14 | ||||
-rw-r--r-- | base/leak_annotations.h | 2 | ||||
-rw-r--r-- | build/build_config.h | 5 | ||||
-rw-r--r-- | build/common.gypi | 9 |
4 files changed, 27 insertions, 3 deletions
diff --git a/base/allocator/allocator.gyp b/base/allocator/allocator.gyp index 0734d2e..b8df28f 100644 --- a/base/allocator/allocator.gyp +++ b/base/allocator/allocator.gyp @@ -332,9 +332,19 @@ # Do the same for heap leak checker. '-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi', '-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl', + ]}, + }], + [ 'linux_use_heapchecker==0', { + # Do not compile and link the heapchecker source. + 'sources!': [ + '<(tcmalloc_dir)/src/heap-checker-bcad.cc', + '<(tcmalloc_dir)/src/heap-checker.cc', ], - }, - }], + # Disable the heap checker in tcmalloc. + 'cflags': [ + '-DNO_HEAP_CHECK', + ], + }], ], }, { diff --git a/base/leak_annotations.h b/base/leak_annotations.h index 8b5c2ad..a402acf 100644 --- a/base/leak_annotations.h +++ b/base/leak_annotations.h @@ -7,7 +7,7 @@ #include "build/build_config.h" -#if defined(OS_LINUX) && defined(USE_TCMALLOC) +#if defined(OS_LINUX) && defined(USE_HEAPCHECKER) #include "third_party/tcmalloc/chromium/src/google/heap-checker.h" diff --git a/build/build_config.h b/build/build_config.h index 29d55b3..154f237 100644 --- a/build/build_config.h +++ b/build/build_config.h @@ -65,6 +65,11 @@ #define USE_TCMALLOC 1 #endif +// Use heapchecker. +#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_HEAPCHECKER) +#define USE_HEAPCHECKER 1 +#endif + // Compiler detection. #if defined(__GNUC__) #define COMPILER_GCC 1 diff --git a/build/common.gypi b/build/common.gypi index c22fb5c..3b8f20e 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -205,6 +205,9 @@ # Enable TCMalloc. 'linux_use_tcmalloc%': 1, + # Disable TCMalloc's heapchecker. + 'linux_use_heapchecker%': 0, + # Set to select the Title Case versions of strings in GRD files. 'use_titlecase_in_grd_files%': 0, @@ -965,9 +968,15 @@ }] ], }], + ['linux_use_heapchecker==1', { + 'variables': {'linux_use_tcmalloc%': 1}, + }], ['linux_use_tcmalloc==0', { 'defines': ['NO_TCMALLOC'], }], + ['linux_use_heapchecker==0', { + 'defines': ['NO_HEAPCHECKER'], + }], ], }, }], |