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

Unified Diff: third_party/tcmalloc/chromium/src/tcmalloc.cc.diff

Issue 9310021: [NOT TO COMMIT!] Merge Chromium-specific changes in tcmalloc thru. the original gperftools r136. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed some build inhibitor. Created 8 years, 11 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
Index: third_party/tcmalloc/chromium/src/tcmalloc.cc.diff
diff --git a/third_party/tcmalloc/chromium/src/tcmalloc.cc.diff b/third_party/tcmalloc/chromium/src/tcmalloc.cc.diff
new file mode 100644
index 0000000000000000000000000000000000000000..b6d0be9890bb31f07e1cfd692d38cc2aeb1af129
--- /dev/null
+++ b/third_party/tcmalloc/chromium/src/tcmalloc.cc.diff
@@ -0,0 +1,79 @@
+*** tcmalloc.cc 2011-05-20 06:37:12.709479000 +0900
+--- tcmalloc.cc 2011-10-14 15:06:18.703743455 +0900
+***************
+*** 287,292 ****
+ // them. In that case, we don't want to do this overriding here.
+ #if !defined(WIN32_DO_PATCHING)
+
+ #if defined(__GNUC__) && !defined(__MACH__)
+ // Potentially faster variants that use the gcc alias extension.
+ // FreeBSD does support aliases, but apparently not correctly. :-(
+--- 300,309 ----
+ // them. In that case, we don't want to do this overriding here.
+ #if !defined(WIN32_DO_PATCHING)
+
++ // TODO(mbelshe): Turn off TCMalloc's symbols for libc. We do that
++ // elsewhere.
++ #ifndef _WIN32
++
+ #if defined(__GNUC__) && !defined(__MACH__)
+ // Potentially faster variants that use the gcc alias extension.
+ // FreeBSD does support aliases, but apparently not correctly. :-(
+***************
+*** 397,402 ****
+ } // extern "C"
+ #endif // ifdef __GLIBC__
+
+ #undef ALIAS
+
+ #endif // #ifndef(WIN32_DO_PATCHING)
+--- 414,448 ----
+ } // extern "C"
+ #endif // ifdef __GLIBC__
+
++ #if defined(__GLIBC__) && defined(HAVE_MALLOC_H)
++ // If we're using glibc, then override glibc malloc hooks to make sure that even
++ // if calls fall through to ptmalloc (due to dlopen() with RTLD_DEEPBIND or what
++ // not), ptmalloc will use TCMalloc.
++
++ static void* tc_ptmalloc_malloc_hook(size_t size, const void* caller) {
++ return tc_malloc(size);
++ }
++
++ void* (*__MALLOC_HOOK_VOLATILE __malloc_hook)(
++ size_t size, const void* caller) = tc_ptmalloc_malloc_hook;
++
++ static void* tc_ptmalloc_realloc_hook(
++ void* ptr, size_t size, const void* caller) {
++ return tc_realloc(ptr, size);
++ }
++
++ void* (*__MALLOC_HOOK_VOLATILE __realloc_hook)(
++ void* ptr, size_t size, const void* caller) = tc_ptmalloc_realloc_hook;
++
++ static void tc_ptmalloc_free_hook(void* ptr, const void* caller) {
++ tc_free(ptr);
++ }
++
++ void (*__MALLOC_HOOK_VOLATILE __free_hook)(void* ptr, const void* caller) = tc_ptmalloc_free_hook;
++
++ #endif
++
++ #endif // #ifndef _WIN32
+ #undef ALIAS
+
+ #endif // #ifndef(WIN32_DO_PATCHING)
+***************
+*** 1729,1734 ****
+ MallocHook::InvokeNewHook(result, size);
+ return result;
+ }
+! void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
+!
+ #endif // TCMALLOC_USING_DEBUGALLOCATION
+--- 1800,1804 ----
+ MallocHook::InvokeNewHook(result, size);
+ return result;
+ }
+! void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
+ #endif // TCMALLOC_USING_DEBUGALLOCATION
« no previous file with comments | « third_party/tcmalloc/chromium/src/tcmalloc.cc ('k') | third_party/tcmalloc/chromium/src/third_party/valgrind.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698