Index: allocator/BUILD.gn |
diff --git a/allocator/BUILD.gn b/allocator/BUILD.gn |
index 8944ad4397438276c42fd87b069c3e99ba549925..5a1e9df190ff7eca9e5640c787e3c65b9f4757f9 100644 |
--- a/allocator/BUILD.gn |
+++ b/allocator/BUILD.gn |
@@ -4,6 +4,13 @@ |
import("//build/config/allocator.gni") |
+declare_args() { |
+ # Provide a way to force disable debugallocation in Debug builds, |
+ # e.g. for profiling (it's more rare to profile Debug builds, |
+ # but people sometimes need to do that). |
+ enable_debugallocation = is_debug |
+} |
+ |
# Only executables and not libraries should depend on the allocator target; |
# only the application (the final executable) knows what allocator makes sense. |
# This "allocator" meta-target will forward to the default allocator according |
@@ -32,6 +39,16 @@ config("allocator_shim_define") { |
} |
} |
+config("tcmalloc_flags") { |
+ if (enable_debugallocation) { |
+ defines = [ |
+ # Use debugallocation for Debug builds to catch problems early |
+ # and cleanly, http://crbug.com/30715 . |
+ "TCMALLOC_FOR_DEBUGALLOCATION", |
+ ] |
+ } |
+} |
+ |
# This config and libc modification are only used on Windows. |
if (is_win) { |
import("//build/config/win/visual_studio_version.gni") |
@@ -195,7 +212,10 @@ if (use_allocator == "tcmalloc") { |
] |
configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
+ configs += [ |
+ "//build/config/compiler:no_chromium_code", |
+ ":tcmalloc_flags", |
+ ] |
deps = [] |