Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: chrome/app/chrome_exe_main_gtk.cc

Issue 399081: Enable TCMalloc on Linux by default. (Closed)
Patch Set: Oops, remove unintended change. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/common.gypi ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_exe_main_gtk.cc
diff --git a/chrome/app/chrome_exe_main_gtk.cc b/chrome/app/chrome_exe_main_gtk.cc
index 9c84f16b003a0d9412284b595b95965b49d8935b..cd2edcb93cc6133092b503fadd0d22f8d9bf27aa 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.
« no previous file with comments | « build/common.gypi ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698