summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2015-08-11 17:14:52 -0500
committertrav90 <travawine@protonmail.ch>2015-08-11 17:14:52 -0500
commit6bc0cd359a230da1783bc5190adbad8acb42addf (patch)
treee5d42fce39f7310f5d43317616f3bb28d97747fc
parent036e63e18f6e71bed8ee77a46ff6a165816143a1 (diff)
downloadpalemoon-gre-6bc0cd359a230da1783bc5190adbad8acb42addf.tar.gz
Revert "Replace g_slice_set_config with G_SLICE env var (Bug 833117)"
-rw-r--r--browser/app/nsBrowserApp.cpp38
-rw-r--r--toolkit/xre/nsAppRunner.cpp7
2 files changed, 7 insertions, 38 deletions
diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp
index f1f78d07c..72ef0e25a 100644
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -55,18 +55,6 @@ using namespace mozilla;
#ifdef XP_WIN
#define kMetroTestFile "tests.ini"
const char* kMetroConsoleIdParam = "testconsoleid=";
-#endif
-
-#if defined(MOZ_WIDGET_GTK) \
- && (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 any g_slice_* functions are called. That is
- // before g_thread_init() for GLib versions prior to 2.32, before
- // g_type_init() for later versions prior to 2.36, and before the library is
- // loaded for later versions.
-#define SET_G_SLICE_ALWAYS_MALLOC 1
#endif
static void Output(const char *fmt, ... )
@@ -163,10 +151,6 @@ XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
XRE_StartupTimelineRecordType XRE_StartupTimelineRecord;
XRE_mainType XRE_main;
XRE_DisableWritePoisoningType XRE_DisableWritePoisoning;
-#if SET_G_SLICE_ALWAYS_MALLOC
-void (*g_thread_init)(void*);
-void (*g_type_init)();
-#endif
static const nsDynamicFunctionLoad kXULFuncs[] = {
{ "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
@@ -178,10 +162,6 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
{ "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
{ "XRE_main", (NSFuncPtr*) &XRE_main },
{ "XRE_DisableWritePoisoning", (NSFuncPtr*) &XRE_DisableWritePoisoning },
-#if SET_G_SLICE_ALWAYS_MALLOC
- { "g_thread_init", (NSFuncPtr*) &g_thread_init },
- { "g_type_init", (NSFuncPtr*) &g_type_init },
-#endif
{ nullptr, nullptr }
};
@@ -570,14 +550,6 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
return NS_ERROR_FAILURE;
}
-#if SET_G_SLICE_ALWAYS_MALLOC
- char *g_slice = getenv("G_SLICE");
- static char tmp_g_slice[] = "G_SLICE=always-malloc";
- if (!g_slice) {
- putenv(tmp_g_slice);
- }
-#endif
-
// We do this because of data in bug 771745
XPCOMGlueEnablePreload();
@@ -593,16 +565,6 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
return rv;
}
-#if SET_G_SLICE_ALWAYS_MALLOC
- if (!g_slice) {
- // Restore the environment for child processes after ensuring that GLib
- // has read the variable.
- g_thread_init(nullptr); // For GLib version < 2.32
- g_type_init(); // For 2.32 <= GLib version < 2.36
- unsetenv("G_SLICE");
- }
-#endif
-
NS_LogInit();
// chop XPCOM_DLL off exePath
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 10053a190..f2473d92f 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3447,6 +3447,13 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
ScopedLogging log;
#if defined(MOZ_WIDGET_GTK)
+#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