Bug 778078 - Disable GLib slice allocator on systems with jemalloc in libc. r=glandium
authorJan Beich <jbeich@tormail.org>
Wed, 17 Oct 2012 16:36:43 +0200
changeset 110675 4cc688fe4e5daf5f0770251a2257cf4dc3cba9ed
parent 110674 543ce048124c3088c81071dfd650f538cface853
child 110676 712c7dbe7c288497f91e9386f05041de587b6a58
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersglandium
bugs778078
milestone19.0a1
Bug 778078 - Disable GLib slice allocator on systems with jemalloc in libc. r=glandium
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -126,16 +126,21 @@ using mozilla::unused;
 #include "nsToolkitCompsCID.h"
 
 #include "nsINIParser.h"
 #include "mozilla/Omnijar.h"
 #include "mozilla/StartupTimeline.h"
 
 #include <stdlib.h>
 
+// for old system jemalloc version check
+#if !defined(MOZ_MEMORY) && defined(__NetBSD__)
+#include <sys/param.h>
+#endif
+
 #ifdef XP_UNIX
 #include <sys/stat.h>
 #include <unistd.h>
 #include <pwd.h>
 #endif
 
 #ifdef XP_WIN
 #include <process.h>
@@ -3819,17 +3824,18 @@ XREMain::XRE_main(int argc, char* argv[]
   if (!mAppData)
     return 1;
   // used throughout this file
   gAppData = mAppData;
 
   ScopedLogging log;
 
 #if defined(MOZ_WIDGET_GTK)
-#ifdef MOZ_MEMORY
+#if defined(MOZ_MEMORY) || defined(__FreeBSD__) \
+  || defined(__NetBSD__) && __NetBSD_Version__ >= 500000000
   // Disable the slice allocator, since jemalloc already uses similar layout
   // algorithms, and using a sub-allocator tends to increase fragmentation.
   // This must be done before g_thread_init() is called.
   g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
 #endif
   g_thread_init(NULL);
 #endif