--- a/build/autoconf/jemalloc.m4
+++ b/build/autoconf/jemalloc.m4
@@ -3,68 +3,35 @@ dnl License, v. 2.0. If a copy of the MP
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
AC_DEFUN([MOZ_SUBCONFIGURE_JEMALLOC], [
if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
# Run jemalloc configure script
- if test "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC4" -o -n "$MOZ_REPLACE_MALLOC"; then
+ if test "$MOZ_MEMORY" && test -n "$MOZ_REPLACE_MALLOC"; then
ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_ --disable-valgrind"
if test -n "$MOZ_DEBUG"; then
ac_configure_args="$ac_configure_args --enable-debug"
fi
# We're using memalign for _aligned_malloc in memory/build/mozmemory_wrap.c
# on Windows, so just export memalign on all platforms.
ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
if test -n "$MOZ_REPLACE_MALLOC"; then
# When using replace_malloc, we always want valloc exported from jemalloc.
ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
if test "${OS_ARCH}" = Darwin; then
# We also need to enable pointer validation on Mac because jemalloc's
# zone allocator is not used.
ac_configure_args="$ac_configure_args --enable-ivsalloc"
fi
fi
- if test -n "$MOZ_JEMALLOC4"; then
- case "${OS_ARCH}" in
- WINNT|Darwin)
- # We want jemalloc functions to be kept hidden on both Mac and Windows
- # See memory/build/mozmemory_wrap.h for details.
- ac_configure_args="$ac_configure_args --without-export"
- ;;
- esac
- if test "${OS_ARCH}" = WINNT; then
- # Lazy lock initialization doesn't play well with lazy linking of
- # mozglue.dll on Windows XP (leads to startup crash), so disable it.
- ac_configure_args="$ac_configure_args --disable-lazy-lock"
-
- # 64-bit Windows builds require a minimum 16-byte alignment.
- if test -n "$HAVE_64BIT_BUILD"; then
- ac_configure_args="$ac_configure_args --with-lg-tiny-min=4"
- fi
- fi
- elif test "${OS_ARCH}" = Darwin; then
- # When building as a replace-malloc lib, disabling the zone allocator
- # forces to use pthread_atfork.
- ac_configure_args="$ac_configure_args --disable-zone-allocator"
- fi
- _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
- JEMALLOC_WRAPPER=
- if test -z "$MOZ_REPLACE_MALLOC"; then
- case "$OS_ARCH" in
- Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
- MANGLE=$_MANGLE
- ;;
- esac
- elif test -z "$MOZ_JEMALLOC4"; then
- MANGLE=$_MANGLE
- JEMALLOC_WRAPPER=replace_
- fi
+ MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
+ JEMALLOC_WRAPPER=replace_
if test -n "$MANGLE"; then
MANGLED=
for mangle in ${MANGLE}; do
if test -n "$MANGLED"; then
MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
else
MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
fi
--- a/build/moz.configure/memory.configure
+++ b/build/moz.configure/memory.configure
@@ -1,20 +1,21 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-option(env='MOZ_JEMALLOC4', help='Enable jemalloc 4')
-imply_option('--enable-jemalloc', depends_if('MOZ_JEMALLOC4')(lambda x: '4'))
+@deprecated_option(env='MOZ_JEMALLOC4')
+def moz_jemalloc4(value):
+ die('MOZ_JEMALLOC4 is deprecated')
-option('--enable-jemalloc', nargs='?', choices=('4', 'moz'), env='MOZ_MEMORY',
+option('--enable-jemalloc', env='MOZ_MEMORY',
help='Replace memory allocator with jemalloc')
@depends('--enable-jemalloc', target, build_project, c_compiler)
def jemalloc(value, target, build_project, c_compiler):
if value.origin != 'default':
return bool(value) or None
if build_project == 'js':
@@ -25,61 +26,50 @@ def jemalloc(value, target, build_projec
return True
if target.kernel == 'WINNT' and c_compiler.type in ('msvc', 'clang-cl'):
return True
if target.kernel == 'Linux':
return True
-@depends('--enable-jemalloc')
-def jemalloc4(jemalloc):
- if len(jemalloc) and jemalloc[0] == '4':
- return True
-
set_config('MOZ_MEMORY', jemalloc)
set_define('MOZ_MEMORY', jemalloc)
add_old_configure_assignment('MOZ_MEMORY', jemalloc)
-set_config('MOZ_JEMALLOC4', jemalloc4)
-set_define('MOZ_JEMALLOC4', jemalloc4)
-add_old_configure_assignment('MOZ_JEMALLOC4', jemalloc4)
-
# Because --enable-jemalloc doesn't use a default because of the dependency
# on the target, we can't use a js_option for it to propagate to js/src
# through the old-configure.
-@depends(jemalloc, jemalloc4)
-def jemalloc_for_old_configure(jemalloc, jemalloc4):
- if jemalloc:
- return '--enable-jemalloc=4' if jemalloc4 else '--enable-jemalloc'
- return '--disable-jemalloc'
+@depends(jemalloc)
+def jemalloc_for_old_configure(jemalloc):
+ return '--%s-jemalloc' % ('enable' if jemalloc else 'disable')
add_old_configure_arg(jemalloc_for_old_configure)
-@depends(jemalloc, jemalloc4, target)
-def jemalloc_os_define(jemalloc, jemalloc4, target):
- if jemalloc and not jemalloc4:
+@depends(jemalloc, target)
+def jemalloc_os_define(jemalloc, target):
+ if jemalloc:
if target.kernel == 'WINNT':
return 'MOZ_MEMORY_WINDOWS'
if target.kernel == 'Linux':
return 'MOZ_MEMORY_LINUX'
if target.kernel == 'Darwin':
return 'MOZ_MEMORY_DARWIN'
if target.kernel in ('kFreeBSD', 'FreeBSD', 'NetBSD'):
return 'MOZ_MEMORY_BSD'
die('--enable-jemalloc is not supported on %s', target.kernel)
set_define(jemalloc_os_define, '1')
-@depends(jemalloc, jemalloc4, target)
-def jemalloc_os_define_android(jemalloc, jemalloc4, target):
- if jemalloc and not jemalloc4 and target.os == 'Android':
+@depends(jemalloc, target)
+def jemalloc_os_define_android(jemalloc, target):
+ if jemalloc and target.os == 'Android':
return 'MOZ_MEMORY_ANDROID'
set_define(jemalloc_os_define_android, '1')
option('--enable-replace-malloc',
help='Enable ability to dynamically replace the malloc implementation')
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -60,20 +60,16 @@
#include "nsIInputStream.h"
#include "nsIXULRuntime.h"
#include "nsJSPrincipals.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
-#if defined(MOZ_JEMALLOC4)
-#include "mozmemory.h"
-#endif
-
#ifdef XP_WIN
#include <windows.h>
#endif
static MOZ_THREAD_LOCAL(XPCJSContext*) gTlsContext;
using namespace mozilla;
using namespace xpc;
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -59,20 +59,16 @@
#include "nsIInputStream.h"
#include "nsIXULRuntime.h"
#include "nsJSPrincipals.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
-#if defined(MOZ_JEMALLOC4)
-#include "mozmemory.h"
-#endif
-
#ifdef XP_WIN
#include <windows.h>
#endif
using namespace mozilla;
using namespace xpc;
using namespace JS;
using mozilla::dom::PerThreadAtomCache;
@@ -147,28 +143,16 @@ public:
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_ASYNC_SNOW_WHITE_FREEING,
uint32_t((TimeStamp::Now() - start).ToMilliseconds()));
if (hadSnowWhiteObjects && !mContinuation) {
mContinuation = true;
if (NS_FAILED(Dispatch())) {
mActive = false;
}
} else {
-#if defined(MOZ_JEMALLOC4)
- if (mPurge) {
- /* Jemalloc purges dirty pages regularly during free() when the
- * ratio of dirty pages compared to active pages is higher than
- * 1 << lg_dirty_mult. A high ratio can have an impact on
- * performance, so we use the default ratio of 8, but force a
- * regular purge of all remaining dirty pages, after cycle
- * collection. */
- Telemetry::AutoTimer<Telemetry::MEMORY_FREE_PURGED_PAGES_MS> timer;
- jemalloc_free_dirty_pages();
- }
-#endif
mActive = false;
}
return NS_OK;
}
nsresult Dispatch()
{
if (NS_IsMainThread()) {
--- a/memory/build/jemalloc_config.cpp
+++ b/memory/build/jemalloc_config.cpp
@@ -1,160 +1,10 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifdef MOZ_JEMALLOC4
-
-#define MOZ_JEMALLOC_IMPL
-
-/* mozmemory_wrap.h needs to be included before MFBT headers */
-#include "mozmemory_wrap.h"
#include <mozilla/Assertions.h>
-#include "mozilla/Types.h"
-
-#define DLLEXPORT
-#include "jemalloc/jemalloc.h"
-
-#ifdef XP_WIN
-#include <windows.h>
-#endif
-#ifdef XP_DARWIN
-#include <sys/mman.h>
-#endif
-
-/* Override some jemalloc defaults */
-#ifdef DEBUG
-#define MOZ_MALLOC_BUILD_OPTIONS ",junk:true"
-#else
-#define MOZ_MALLOC_BUILD_OPTIONS ",junk:free"
-#endif
-
-#define MOZ_MALLOC_OPTIONS "narenas:1,tcache:false"
-MFBT_DATA const char* je_(malloc_conf) =
- MOZ_MALLOC_OPTIONS MOZ_MALLOC_BUILD_OPTIONS;
-
-#ifdef ANDROID
-#include <android/log.h>
-
-static void
-_je_malloc_message(void* cbopaque, const char* s)
-{
- __android_log_print(ANDROID_LOG_INFO, "GeckoJemalloc", "%s", s);
-}
-
-void (*je_(malloc_message))(void*, const char* s) = _je_malloc_message;
-#endif
-
-/* Jemalloc supports hooks that are called on chunk
- * allocate/deallocate/commit/decommit/purge/etc.
- *
- * We currently only hook commit, decommit and purge. We do this to tweak
- * the way chunks are handled so that RSS stays lower than it normally
- * would with the default jemalloc uses.
- * This somewhat matches the behavior of mozjemalloc, except it doesn't
- * rely on a double purge on mac, instead purging directly. (Yes, this
- * means we can get rid of jemalloc_purge_freed_pages at some point)
- *
- * The default for jemalloc is to do the following:
- * - commit, decommit: nothing
- * - purge: MEM_RESET on Windows, MADV_FREE on Mac/BSD, MADV_DONTNEED on Linux
- *
- * The hooks we setup do the following:
- * on Windows:
- * - commit: MEM_COMMIT
- * - decommit: MEM_DECOMMIT
- * on Mac:
- * - purge: mmap new anonymous memory on top of the chunk
- *
- * We only set the above hooks, others are left with the default.
- */
-#if defined(XP_WIN) || defined(XP_DARWIN)
-class JemallocInit {
-public:
- JemallocInit()
- {
- chunk_hooks_t hooks;
- size_t hooks_len;
- unsigned narenas;
- size_t mib[3];
- size_t size;
-
- size = sizeof(narenas);
- je_(mallctl)("arenas.narenas", &narenas, &size, nullptr, 0);
-
- size = sizeof(mib) / sizeof(mib[0]);
- je_(mallctlnametomib)("arena.0.chunk_hooks", mib, &size);
-
- /* Set the hooks on all the existing arenas. */
- for (unsigned arena = 0; arena < narenas; arena++) {
- mib[1] = arena;
- hooks_len = sizeof(hooks);
- je_(mallctlbymib)(mib, size, &hooks, &hooks_len, nullptr, 0);
-
-#ifdef XP_WIN
- hooks.commit = CommitHook;
- hooks.decommit = DecommitHook;
-#endif
-#ifdef XP_DARWIN
- hooks.purge = PurgeHook;
-#endif
-
- je_(mallctlbymib)(mib, size, nullptr, nullptr, &hooks, hooks_len);
- }
- }
-
-private:
-#ifdef XP_WIN
- static bool
- CommitHook(void* chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
- {
- void* addr = reinterpret_cast<void*>(
- reinterpret_cast<uintptr_t>(chunk) + static_cast<uintptr_t>(offset));
-
- if (!VirtualAlloc(addr, length, MEM_COMMIT, PAGE_READWRITE))
- return true;
-
- return false;
- }
-
- static bool
- DecommitHook(void* chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
- {
- void* addr = reinterpret_cast<void*>(
- reinterpret_cast<uintptr_t>(chunk) + static_cast<uintptr_t>(offset));
-
- if (!VirtualFree(addr, length, MEM_DECOMMIT))
- MOZ_CRASH();
-
- return false;
- }
-#endif
-
-#ifdef XP_DARWIN
- static bool
- PurgeHook(void* chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
- {
- void* addr = reinterpret_cast<void*>(
- reinterpret_cast<uintptr_t>(chunk) + static_cast<uintptr_t>(offset));
-
- void* new_addr = mmap(addr, length, PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
- return (new_addr != addr);
- }
-#endif
-};
-
-/* For the static constructor from the class above */
-JemallocInit gJemallocInit;
-#endif
-
-#else
-#include <mozilla/Assertions.h>
-#endif /* MOZ_JEMALLOC4 */
/* Provide an abort function for use in jemalloc code */
extern "C" void moz_abort() {
MOZ_CRASH();
}
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -19,41 +19,27 @@ if CONFIG['MOZ_REPLACE_MALLOC']:
'replace_malloc_bridge.h',
]
SOURCES += [
'jemalloc_config.cpp',
'mozmemory_wrap.c',
]
-if CONFIG['MOZ_JEMALLOC4']:
- SOURCES += [
- 'mozjemalloc_compat.c',
- ]
- LOCAL_INCLUDES += ['!../jemalloc/src/include']
- if CONFIG['_MSC_VER']:
- LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat']
- if not CONFIG['HAVE_INTTYPES_H']:
- LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat/C99']
-
if CONFIG['MOZ_REPLACE_MALLOC']:
SOURCES += [
'replace_malloc.c',
]
if CONFIG['OS_TARGET'] == 'Darwin' and (CONFIG['MOZ_REPLACE_MALLOC'] or
- CONFIG['MOZ_MEMORY'] and not CONFIG['MOZ_JEMALLOC4']):
+ CONFIG['MOZ_MEMORY']):
SOURCES += [
'zone.c',
]
Library('memory')
if CONFIG['MOZ_GLUE_IN_PROGRAM']:
DIST_INSTALL = True
# Keep jemalloc separated when mozglue is statically linked
if CONFIG['MOZ_MEMORY'] and CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
FINAL_LIBRARY = 'mozglue'
-
-if CONFIG['MOZ_REPLACE_MALLOC'] and CONFIG['OS_TARGET'] == 'Darwin':
- # The zone allocator for OSX needs some jemalloc internal functions
- LOCAL_INCLUDES += ['/memory/jemalloc/src/include']
--- a/memory/build/zone.c
+++ b/memory/build/zone.c
@@ -231,40 +231,16 @@ zone_print(malloc_zone_t *zone, boolean_
{
}
static void
zone_log(malloc_zone_t *zone, void *address)
{
}
-#ifdef MOZ_JEMALLOC4
-
-#include "jemalloc/internal/jemalloc_internal.h"
-
-static void
-zone_force_lock(malloc_zone_t *zone)
-{
- /* /!\ This calls into jemalloc. It works because we're linked in the
- * same library. Stolen from jemalloc's zone.c. */
- if (isthreaded)
- jemalloc_prefork();
-}
-
-static void
-zone_force_unlock(malloc_zone_t *zone)
-{
- /* /!\ This calls into jemalloc. It works because we're linked in the
- * same library. Stolen from jemalloc's zone.c. See the comment there. */
- if (isthreaded)
- jemalloc_postfork_child();
-}
-
-#else
-
extern void _malloc_prefork(void);
extern void _malloc_postfork_child(void);
static void
zone_force_lock(malloc_zone_t *zone)
{
/* /!\ This calls into mozjemalloc. It works because we're linked in the
* same library. */
@@ -274,18 +250,16 @@ zone_force_lock(malloc_zone_t *zone)
static void
zone_force_unlock(malloc_zone_t *zone)
{
/* /!\ This calls into mozjemalloc. It works because we're linked in the
* same library. */
_malloc_postfork_child();
}
-#endif
-
static void
zone_statistics(malloc_zone_t *zone, malloc_statistics_t *stats)
{
/* We make no effort to actually fill the values */
stats->blocks_in_use = 0;
stats->size_in_use = 0;
stats->max_size_in_use = 0;
stats->size_allocated = 0;
@@ -331,19 +305,16 @@ static malloc_zone_t *get_default_zone()
}
if (num_zones) {
return zones[0];
}
return malloc_default_zone();
}
-#if defined(MOZ_REPLACE_MALLOC) && defined(MOZ_JEMALLOC4)
-__attribute__((constructor))
-#endif
void
register_zone(void)
{
malloc_zone_t *default_zone = get_default_zone();
zone.size = zone_size;
zone.malloc = zone_malloc;
zone.calloc = zone_calloc;
--- a/memory/jemalloc/moz.build
+++ b/memory/jemalloc/moz.build
@@ -44,20 +44,17 @@ maybe_unified_sources += [
# Only OSX needs the zone allocation implementation,
# but only if replace-malloc is not enabled.
if CONFIG['OS_TARGET'] == 'Darwin' and not CONFIG['MOZ_REPLACE_MALLOC']:
maybe_unified_sources += [
'src/src/zone.c',
]
-if CONFIG['MOZ_JEMALLOC4']:
- FINAL_LIBRARY = 'memory'
-else:
- FINAL_LIBRARY = 'replace_jemalloc'
+FINAL_LIBRARY = 'replace_jemalloc'
if CONFIG['MOZ_GLUE_IN_PROGRAM']:
DIST_INSTALL = True
if CONFIG['_MSC_VER']:
DEFINES['DLLEXPORT'] = True
LOCAL_INCLUDES += ['src/include/msvc_compat']
if not CONFIG['HAVE_INTTYPES_H']:
--- a/memory/moz.build
+++ b/memory/moz.build
@@ -18,13 +18,13 @@ if not CONFIG['JS_STANDALONE']:
if CONFIG['MOZ_MEMORY']:
# NB: gtest dir is included in toolkit/toolkit.build due to its dependency
# on libxul.
DIRS += [
'build',
'mozjemalloc',
]
- if CONFIG['MOZ_JEMALLOC4'] or CONFIG['MOZ_REPLACE_MALLOC']:
+ if CONFIG['MOZ_REPLACE_MALLOC']:
DIRS += ['jemalloc']
if CONFIG['MOZ_REPLACE_MALLOC']:
DIRS += ['replace']
--- a/memory/mozjemalloc/Makefile.in
+++ b/memory/mozjemalloc/Makefile.in
@@ -1,13 +1,11 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-ifndef MOZ_JEMALLOC4
# Force optimize mozjemalloc on --disable-optimize builds.
# This works around the issue that the Android NDK's definition of ffs is
# broken when compiling without optimization, while avoiding to add yet another
# configure test.
MOZ_OPTIMIZE = 1
-endif
--- a/memory/mozjemalloc/moz.build
+++ b/memory/mozjemalloc/moz.build
@@ -3,26 +3,25 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS += [
'jemalloc_types.h',
]
-if not CONFIG['MOZ_JEMALLOC4']:
- SOURCES += [
- 'jemalloc.c',
- ]
- FINAL_LIBRARY = 'memory'
+SOURCES += [
+ 'jemalloc.c',
+]
+FINAL_LIBRARY = 'memory'
- # See bug 422055.
- if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC'] \
- and CONFIG['MOZ_OPTIMIZE']:
- CFLAGS += ['-xO5']
+# See bug 422055.
+if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC'] \
+ and CONFIG['MOZ_OPTIMIZE']:
+ CFLAGS += ['-xO5']
# For non release/esr builds, enable (some) fatal jemalloc assertions. This
# helps us catch memory errors.
if CONFIG['MOZ_UPDATE_CHANNEL'] not in ('release', 'esr'):
DEFINES['MOZ_JEMALLOC_HARD_ASSERTS'] = True
DEFINES['abort'] = 'moz_abort'
--- a/memory/replace/logalloc/replay/Replay.cpp
+++ b/memory/replace/logalloc/replay/Replay.cpp
@@ -281,17 +281,17 @@ MOZ_BEGIN_EXTERN_C
#define MALLOC_DECL(name, return_type, ...) \
return_type name ## _impl(__VA_ARGS__);
#define MALLOC_FUNCS MALLOC_FUNCS_JEMALLOC
#include "malloc_decls.h"
/* mozjemalloc relies on DllMain to initialize, but DllMain is not invoked
* for executables, so manually invoke mozjemalloc initialization. */
-#if defined(_WIN32) && !defined(MOZ_JEMALLOC4)
+#if defined(_WIN32)
void malloc_init_hard(void);
#endif
#ifdef ANDROID
/* mozjemalloc uses MozTagAnonymousMemory, which doesn't have an inline
* implementation on Android */
void
MozTagAnonymousMemory(const void* aPtr, size_t aLength, const char* aTag) {}
@@ -470,17 +470,17 @@ private:
int
main()
{
size_t first_pid = 0;
FdReader reader(0);
Replay replay;
-#if defined(_WIN32) && !defined(MOZ_JEMALLOC4)
+#if defined(_WIN32)
malloc_init_hard();
#endif
/* Read log from stdin and dispatch function calls to the Replay instance.
* The log format is essentially:
* <pid> <function>([<args>])[=<result>]
* <args> is a comma separated list of arguments.
*
--- a/memory/replace/moz.build
+++ b/memory/replace/moz.build
@@ -4,17 +4,16 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += [
'logalloc',
'replace',
]
-# Build jemalloc3 as a replace-malloc lib when building with mozjemalloc
-if not CONFIG['MOZ_JEMALLOC4']:
- DIRS += ['jemalloc']
+# Build jemalloc4 as a replace-malloc lib when building with mozjemalloc
+DIRS += ['jemalloc']
if CONFIG['MOZ_REPLACE_MALLOC_LINKAGE'] == 'dummy library':
DIRS += ['dummy']
if CONFIG['MOZ_DMD']:
DIRS += ['dmd']
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -60,17 +60,17 @@ option('--enable-dmd', env='MOZ_DMD',
def dmd(value):
if value:
return True
set_config('MOZ_DMD', dmd)
set_define('MOZ_DMD', dmd)
add_old_configure_assignment('MOZ_DMD', dmd)
imply_option('--enable-profiling', dmd)
-# --enable-jemalloc is implied below.
+imply_option('--enable-jemalloc', dmd)
imply_option('--enable-replace-malloc', dmd)
# JACK cubeb backend
# ==============================================================
option('--enable-jack', env='MOZ_JACK',
help='Enable JACK audio backend.')
@depends('--enable-jack')
@@ -717,28 +717,16 @@ def stylo(stylo_enabled, bindgen_config_
set_config('MOZ_STYLO', delayed_getattr(stylo, 'enabled'))
set_define('MOZ_STYLO', delayed_getattr(stylo, 'enabled'))
set_config('MOZ_LIBCLANG_PATH', delayed_getattr(stylo, 'libclang_path'))
set_config('MOZ_CLANG_PATH', delayed_getattr(stylo, 'clang_path'))
set_config('MOZ_STYLO_BINDGEN', delayed_getattr(stylo, 'bindgen_enabled'))
-@depends(stylo, target, dmd)
-def jemalloc(stylo, target, dmd):
- if stylo and target.kernel in ('Darwin', 'Linux', 'WINNT'):
- # Avoid a moving performance target if the default allocator
- # is changed on Tier1 platforms (see bug 1291356).
- return 'moz'
- elif dmd:
- return True
-
-imply_option('--enable-jemalloc', jemalloc,
- reason='--enable-dmd or --enable-stylo')
-
option('--with-servo', env='SERVO_TARGET_DIR', nargs=1,
help='Absolute path of the target directory where libgeckoservo can '
'be found. This is generally servo_src_dir/target/release.')
@depends_if('--with-servo')
def servo_target_dir(value):
return value[0]
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -438,23 +438,21 @@ VsizeDistinguishedAmount(int64_t* aN)
// memory pressure, so ideally, they shouldn't count against our RSS.
//
// Purging these pages can take a long time for some users (see bug 789975),
// so we provide the option to get the RSS without purging first.
static MOZ_MUST_USE nsresult
ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge)
{
#ifdef HAVE_JEMALLOC_STATS
-#ifndef MOZ_JEMALLOC4
if (aDoPurge) {
Telemetry::AutoTimer<Telemetry::MEMORY_FREE_PURGED_PAGES_MS> timer;
jemalloc_purge_freed_pages();
}
#endif
-#endif
task_basic_info ti;
if (!GetTaskBasicInfo(&ti)) {
return NS_ERROR_FAILURE;
}
*aN = ti.resident_size;
return NS_OK;
}