summaryrefslogtreecommitdiffstats
path: root/chrome/app/chrome_exe_main_gtk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/app/chrome_exe_main_gtk.cc')
-rw-r--r--chrome/app/chrome_exe_main_gtk.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/app/chrome_exe_main_gtk.cc b/chrome/app/chrome_exe_main_gtk.cc
index 9c84f16..cd2edcb 100644
--- a/chrome/app/chrome_exe_main_gtk.cc
+++ b/chrome/app/chrome_exe_main_gtk.cc
@@ -16,12 +16,30 @@
extern "C" {
int ChromeMain(int argc, const char** argv);
+
+#if defined(LINUX_USE_TCMALLOC)
+
+int tc_set_new_mode(int mode);
+
+#endif // defined(LINUX_USE_TCMALLOC)
+
}
int main(int argc, const char** argv) {
base::EnableTerminationOnHeapCorruption();
base::EnableTerminationOnOutOfMemory();
+ // NOTE(willchan): One might ask why this call is done here rather than in
+ // process_util_linux.cc with the definition of
+ // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a
+ // dependency on TCMalloc. Really, we ought to have our allocator shim code
+ // implement this EnableTerminationOnOutOfMemory() function. Whateverz. This
+ // works for now.
+#if defined(LINUX_USE_TCMALLOC)
+ // For tcmalloc, we need to tell it to behave like new.
+ tc_set_new_mode(1);
+#endif
+
// The exit manager is in charge of calling the dtors of singletons.
// Win has one here, but we assert with multiples from BrowserMain() if we
// keep it.