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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 *** tcmalloc.cc 2011-05-20 06:37:12.709479000 +0900
2 --- tcmalloc.cc 2011-10-14 15:06:18.703743455 +0900
3 ***************
4 *** 287,292 ****
5 // them. In that case, we don't want to do this overriding here.
6 #if !defined(WIN32_DO_PATCHING)
7
8 #if defined(__GNUC__) && !defined(__MACH__)
9 // Potentially faster variants that use the gcc alias extension.
10 // FreeBSD does support aliases, but apparently not correctly. :-(
11 --- 300,309 ----
12 // them. In that case, we don't want to do this overriding here.
13 #if !defined(WIN32_DO_PATCHING)
14
15 + // TODO(mbelshe): Turn off TCMalloc's symbols for libc. We do that
16 + // elsewhere.
17 + #ifndef _WIN32
18 +
19 #if defined(__GNUC__) && !defined(__MACH__)
20 // Potentially faster variants that use the gcc alias extension.
21 // FreeBSD does support aliases, but apparently not correctly. :-(
22 ***************
23 *** 397,402 ****
24 } // extern "C"
25 #endif // ifdef __GLIBC__
26
27 #undef ALIAS
28
29 #endif // #ifndef(WIN32_DO_PATCHING)
30 --- 414,448 ----
31 } // extern "C"
32 #endif // ifdef __GLIBC__
33
34 + #if defined(__GLIBC__) && defined(HAVE_MALLOC_H)
35 + // If we're using glibc, then override glibc malloc hooks to make sure that ev en
36 + // if calls fall through to ptmalloc (due to dlopen() with RTLD_DEEPBIND or wh at
37 + // not), ptmalloc will use TCMalloc.
38 +
39 + static void* tc_ptmalloc_malloc_hook(size_t size, const void* caller) {
40 + return tc_malloc(size);
41 + }
42 +
43 + void* (*__MALLOC_HOOK_VOLATILE __malloc_hook)(
44 + size_t size, const void* caller) = tc_ptmalloc_malloc_hook;
45 +
46 + static void* tc_ptmalloc_realloc_hook(
47 + void* ptr, size_t size, const void* caller) {
48 + return tc_realloc(ptr, size);
49 + }
50 +
51 + void* (*__MALLOC_HOOK_VOLATILE __realloc_hook)(
52 + void* ptr, size_t size, const void* caller) = tc_ptmalloc_realloc_hook;
53 +
54 + static void tc_ptmalloc_free_hook(void* ptr, const void* caller) {
55 + tc_free(ptr);
56 + }
57 +
58 + void (*__MALLOC_HOOK_VOLATILE __free_hook)(void* ptr, const void* caller) = tc _ptmalloc_free_hook;
59 +
60 + #endif
61 +
62 + #endif // #ifndef _WIN32
63 #undef ALIAS
64
65 #endif // #ifndef(WIN32_DO_PATCHING)
66 ***************
67 *** 1729,1734 ****
68 MallocHook::InvokeNewHook(result, size);
69 return result;
70 }
71 ! void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
72 !
73 #endif // TCMALLOC_USING_DEBUGALLOCATION
74 --- 1800,1804 ----
75 MallocHook::InvokeNewHook(result, size);
76 return result;
77 }
78 ! void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
79 #endif // TCMALLOC_USING_DEBUGALLOCATION
OLDNEW
« 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