summaryrefslogtreecommitdiffstats
path: root/build/config/allocator.gni
blob: c79f930b3d911e1d2eb654813f6de593d53199be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/sanitizers/sanitizers.gni")

if (is_android || current_cpu == "mipsel" || is_mac || is_ios || is_asan ||
    is_lsan || is_tsan || is_msan || is_win || is_syzyasan) {
  _default_allocator = "none"
} else {
  _default_allocator = "tcmalloc"
}

if (is_linux && !is_asan && !is_lsan && !is_tsan && !is_msan) {
  _default_use_experimental_allocator_shim = true
} else {
  _default_use_experimental_allocator_shim = false
}

declare_args() {
  # Memory allocator to use. Set to "none" to use default allocator.
  use_allocator = _default_allocator

  # TODO(primiano): this should just become the default without having a flag,
  # but we need to get there first. http://crbug.com/550886 .
  # Causes all the allocations to be routed via allocator_shim.cc.
  use_experimental_allocator_shim = _default_use_experimental_allocator_shim
}

assert(use_allocator == "none" || use_allocator == "tcmalloc")

assert(!is_win || use_allocator == "none", "Tcmalloc doesn't work on Windows.")
assert(!use_experimental_allocator_shim || is_linux,
       "use_experimental_allocator_shim supported only on Linux")