Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1387)

Unified Diff: third_party/tcmalloc/chromium/src/libc_override.h

Issue 1678893002: allocator: add use_experimental_allocator_shim build flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tcmalloc/README.chromium ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/libc_override.h
diff --git a/third_party/tcmalloc/chromium/src/libc_override.h b/third_party/tcmalloc/chromium/src/libc_override.h
index 089084a2e4988d34fd0723f4d651f194e264a2c4..941d3924a6a24b09d950f2d6998000fa2d4bd51a 100644
--- a/third_party/tcmalloc/chromium/src/libc_override.h
+++ b/third_party/tcmalloc/chromium/src/libc_override.h
@@ -59,12 +59,22 @@
static void ReplaceSystemAlloc(); // defined in the .h files below
+#if defined(TCMALLOC_DONT_REPLACE_SYSTEM_ALLOC)
+// TCMALLOC_DONT_REPLACE_SYSTEM_ALLOC has the following semantic:
+// - tcmalloc with all its tc_* (tc_malloc, tc_free) symbols is being built
+// and linked as usual.
+// - the default system allocator symbols (malloc, free, operator new) are NOT
+// overridden. The embedded must take care of routing them to tc_* symbols.
+// This no-op #if block effectively prevents the inclusion of the
+// libc_override_* headers below.
+static void ReplaceSystemAlloc() {}
Nico 2016/02/09 20:14:23 Which files include this? Defining static function
Primiano Tucci (use gerrit) 2016/02/09 20:34:23 So I think that the deal is that this header is a
+
// For windows, there are two ways to get tcmalloc. If we're
// patching, then src/windows/patch_function.cc will do the necessary
// overriding here. Otherwise, we doing the 'redefine' trick, where
// we remove malloc/new/etc from mscvcrt.dll, and just need to define
// them now.
-#if defined(_WIN32) && defined(WIN32_DO_PATCHING)
+#elif defined(_WIN32) && defined(WIN32_DO_PATCHING)
void PatchWindowsFunctions(); // in src/windows/patch_function.cc
static void ReplaceSystemAlloc() { PatchWindowsFunctions(); }
« no previous file with comments | « third_party/tcmalloc/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698