OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/allocator/allocator_shim.h" | 5 #include "base/allocator/allocator_shim.h" |
6 | 6 |
7 #include <config.h> | 7 #include <config.h> |
| 8 #include "base/sysinfo.h" |
8 | 9 |
9 // When defined, different heap allocators can be used via an environment | 10 // When defined, different heap allocators can be used via an environment |
10 // variable set before running the program. This may reduce the amount | 11 // variable set before running the program. This may reduce the amount |
11 // of inlining that we get with malloc/free/etc. Disabling makes it | 12 // of inlining that we get with malloc/free/etc. Disabling makes it |
12 // so that only tcmalloc can be used. | 13 // so that only tcmalloc can be used. |
13 #define ENABLE_DYNAMIC_ALLOCATOR_SWITCHING | 14 #define ENABLE_DYNAMIC_ALLOCATOR_SWITCHING |
14 | 15 |
15 // TODO(mbelshe): Ensure that all calls to tcmalloc have the proper call depth | 16 // TODO(mbelshe): Ensure that all calls to tcmalloc have the proper call depth |
16 // from the "user code" so that debugging tools (HeapChecker) can work. | 17 // from the "user code" so that debugging tools (HeapChecker) can work. |
17 | 18 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 char* secondary_value = secondary_length ? buffer : "TCMALLOC"; | 297 char* secondary_value = secondary_length ? buffer : "TCMALLOC"; |
297 // Force renderer (or other subprocesses) to use secondary_value. | 298 // Force renderer (or other subprocesses) to use secondary_value. |
298 int ret_val = _putenv_s(primary_name, secondary_value); | 299 int ret_val = _putenv_s(primary_name, secondary_value); |
299 CHECK_EQ(0, ret_val); | 300 CHECK_EQ(0, ret_val); |
300 } | 301 } |
301 #endif // ENABLE_DYNAMIC_ALLOCATOR_SWITCHING | 302 #endif // ENABLE_DYNAMIC_ALLOCATOR_SWITCHING |
302 } | 303 } |
303 | 304 |
304 } // namespace base. | 305 } // namespace base. |
305 } // namespace allocator. | 306 } // namespace allocator. |
OLD | NEW |