OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/allocator/allocator_check.h" | |
6 | |
7 #include "build/build_config.h" | |
8 | |
9 #if defined(OS_LINUX) | |
10 #include <malloc.h> | |
11 #endif | |
12 | |
13 namespace base { | |
14 namespace allocator { | |
15 | |
16 // Defined in allocator_shim_win.cc . | |
17 // TODO(primiano): replace with an include once base can depend on allocator. | |
18 #if defined(OS_WIN) && !defined(COMPONENT_BUILD) | |
19 extern bool g_is_win_shim_layer_initialized; | |
20 #endif | |
21 | |
22 bool IsAllocatorInitialized() { | |
23 #if defined(OS_WIN) && !defined(COMPONENT_BUILD) | |
Will Harris
2016/01/11 22:51:31
I think this needs a MEMORY_TOOL_REPLACES_ALLOCATO
Primiano Tucci (use gerrit)
2016/01/11 23:32:05
Ah right. good spot. I'll fix it tomorrow EMEA mor
Primiano Tucci (use gerrit)
2016/01/12 11:36:01
Ok fixed. ALLOCATOR_SHIM seems the way to go. I c
| |
24 // Set by allocator_shim_win.cc when the shimmed _heap_init() is called. | |
25 return g_is_win_shim_layer_initialized; | |
26 #elif defined(OS_LINUX) && defined(USE_TCMALLOC) | |
27 // From third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h. | |
28 // TODO(primiano): replace with an include once base can depend on allocator. | |
29 #define TC_MALLOPT_IS_OVERRIDDEN_BY_TCMALLOC 0xbeef42 | |
30 return mallopt(TC_MALLOPT_IS_OVERRIDDEN_BY_TCMALLOC, 0) == 0; | |
31 #else | |
32 return true; | |
33 #endif | |
34 } | |
35 | |
36 } // namespace allocator | |
37 } // namespace base | |
OLD | NEW |