summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-04-27 13:56:47 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-04-27 13:56:47 +0200
commit077c63084488ac38c1c44e8cdaa9c33086f0a649 (patch)
treec528abc8ae8570e66fecb123a9a1e821993f1f27
parentbe1786f7b0e692d8f4326dbf53e7d0689813ee2d (diff)
downloadUXP-077c63084488ac38c1c44e8cdaa9c33086f0a649.tar
UXP-077c63084488ac38c1c44e8cdaa9c33086f0a649.tar.gz
UXP-077c63084488ac38c1c44e8cdaa9c33086f0a649.tar.lz
UXP-077c63084488ac38c1c44e8cdaa9c33086f0a649.tar.xz
UXP-077c63084488ac38c1c44e8cdaa9c33086f0a649.zip
Remove support for making jemalloc4 the default memory allocator.
-rw-r--r--build/autoconf/jemalloc.m439
-rw-r--r--build/moz.configure/memory.configure38
-rw-r--r--js/xpconnect/src/XPCJSContext.cpp16
-rw-r--r--memory/build/jemalloc_config.cpp150
-rw-r--r--memory/build/moz.build13
-rw-r--r--memory/build/mozjemalloc_compat.c178
-rw-r--r--memory/jemalloc/moz.build5
-rw-r--r--memory/moz.build2
-rw-r--r--memory/mozjemalloc/moz.build19
-rw-r--r--memory/replace/logalloc/replay/Replay.cpp4
-rw-r--r--memory/replace/moz.build5
-rw-r--r--xpcom/base/nsMemoryReporterManager.cpp2
12 files changed, 32 insertions, 439 deletions
diff --git a/build/autoconf/jemalloc.m4 b/build/autoconf/jemalloc.m4
index eae4e4d3a..21fed27e9 100644
--- a/build/autoconf/jemalloc.m4
+++ b/build/autoconf/jemalloc.m4
@@ -8,7 +8,7 @@ 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"
# We're using memalign for _aligned_malloc in memory/build/mozmemory_wrap.c
# on Windows, so just export memalign on all platforms.
@@ -22,41 +22,8 @@ if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
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
diff --git a/build/moz.configure/memory.configure b/build/moz.configure/memory.configure
index 3beed2fb2..398413b62 100644
--- a/build/moz.configure/memory.configure
+++ b/build/moz.configure/memory.configure
@@ -5,12 +5,13 @@
# 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 no longer supported')
-option('--enable-jemalloc', nargs='?', choices=('4', 'moz'), env='MOZ_MEMORY',
- help='Replace memory allocator with jemalloc')
+option('--enable-jemalloc', env='MOZ_MEMORY',
+ help='Replace system memory allocator with jemalloc')
@depends('--enable-jemalloc', target, build_project, c_compiler)
def jemalloc(value, target, build_project, c_compiler):
@@ -30,36 +31,25 @@ def jemalloc(value, target, build_project, c_compiler):
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':
@@ -72,9 +62,9 @@ def jemalloc_os_define(jemalloc, jemalloc4, target):
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')
diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp
index f5f6a11bb..8862bca32 100644
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -59,10 +59,6 @@
#include "nsIXULRuntime.h"
#include "nsJSPrincipals.h"
-#if defined(MOZ_JEMALLOC4)
-#include "mozmemory.h"
-#endif
-
#ifdef XP_WIN
#include <windows.h>
#endif
@@ -147,18 +143,6 @@ public:
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;
diff --git a/memory/build/jemalloc_config.cpp b/memory/build/jemalloc_config.cpp
index 1a83c79e2..0b734d804 100644
--- a/memory/build/jemalloc_config.cpp
+++ b/memory/build/jemalloc_config.cpp
@@ -2,157 +2,7 @@
* 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() {
diff --git a/memory/build/moz.build b/memory/build/moz.build
index bd6c2503e..f4fd82878 100644
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -24,16 +24,6 @@ SOURCES += [
'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',
@@ -49,6 +39,3 @@ if CONFIG['MOZ_GLUE_IN_PROGRAM']:
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']
diff --git a/memory/build/mozjemalloc_compat.c b/memory/build/mozjemalloc_compat.c
deleted file mode 100644
index 0b3b333d4..000000000
--- a/memory/build/mozjemalloc_compat.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* 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
-# error Should only compile this file when building with jemalloc 3
-#endif
-
-#define MOZ_JEMALLOC_IMPL
-
-#include "mozmemory_wrap.h"
-#include "jemalloc_types.h"
-#include "mozilla/Types.h"
-
-#include <stdbool.h>
-
-#include "jemalloc/jemalloc.h"
-
-/*
- * CTL_* macros are from memory/jemalloc/src/src/stats.c with changes:
- * - drop `t' argument to avoid redundancy in calculating type size
- * - require `i' argument for arena number explicitly
- */
-
-#define CTL_GET(n, v) do { \
- size_t sz = sizeof(v); \
- je_(mallctl)(n, &v, &sz, NULL, 0); \
-} while (0)
-
-#define CTL_I_GET(n, v, i) do { \
- size_t mib[6]; \
- size_t miblen = sizeof(mib) / sizeof(mib[0]); \
- size_t sz = sizeof(v); \
- je_(mallctlnametomib)(n, mib, &miblen); \
- mib[2] = i; \
- je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \
-} while (0)
-
-#define CTL_IJ_GET(n, v, i, j) do { \
- size_t mib[6]; \
- size_t miblen = sizeof(mib) / sizeof(mib[0]); \
- size_t sz = sizeof(v); \
- je_(mallctlnametomib)(n, mib, &miblen); \
- mib[2] = i; \
- mib[4] = j; \
- je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \
-} while (0)
-
-/*
- * VARIABLE_ARRAY is copied from
- * memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal.h.in
- */
-#if __STDC_VERSION__ < 199901L
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# include <stdlib.h>
-# endif
-# endif
-# define VARIABLE_ARRAY(type, name, count) \
- type *name = alloca(sizeof(type) * (count))
-#else
-# define VARIABLE_ARRAY(type, name, count) type name[(count)]
-#endif
-
-MOZ_MEMORY_API size_t
-malloc_good_size_impl(size_t size)
-{
- /* je_nallocx crashes when given a size of 0. As
- * malloc_usable_size(malloc(0)) and malloc_usable_size(malloc(1))
- * return the same value, use a size of 1. */
- if (size == 0)
- size = 1;
- return je_(nallocx)(size, 0);
-}
-
-static void
-compute_bin_unused_and_bookkeeping(jemalloc_stats_t *stats, unsigned int narenas)
-{
- size_t bin_unused = 0;
-
- uint32_t nregs; // number of regions per run in the j-th bin
- size_t reg_size; // size of regions served by the j-th bin
- size_t curruns; // number of runs belonging to a bin
- size_t curregs; // number of allocated regions in a bin
-
- unsigned int nbins; // number of bins per arena
- unsigned int i, j;
-
- size_t stats_metadata;
- size_t stats_ametadata = 0; // total internal allocations in all arenas
-
- // narenas also counts uninitialized arenas, and initialized arenas
- // are not guaranteed to be adjacent
- VARIABLE_ARRAY(bool, initialized, narenas);
- size_t isz = sizeof(initialized) / sizeof(initialized[0]);
-
- je_(mallctl)("arenas.initialized", initialized, &isz, NULL, 0);
- CTL_GET("arenas.nbins", nbins);
-
- for (j = 0; j < nbins; j++) {
- CTL_I_GET("arenas.bin.0.nregs", nregs, j);
- CTL_I_GET("arenas.bin.0.size", reg_size, j);
-
- for (i = 0; i < narenas; i++) {
- if (!initialized[i]) {
- continue;
- }
-
- CTL_IJ_GET("stats.arenas.0.bins.0.curruns", curruns, i, j);
- CTL_IJ_GET("stats.arenas.0.bins.0.curregs", curregs, i, j);
-
- bin_unused += (nregs * curruns - curregs) * reg_size;
- }
- }
-
- CTL_GET("stats.metadata", stats_metadata);
-
- /* get the summation for all arenas, i == narenas */
- CTL_I_GET("stats.arenas.0.metadata.allocated", stats_ametadata, narenas);
-
- stats->bookkeeping = stats_metadata - stats_ametadata;
- stats->bin_unused = bin_unused;
-}
-
-MOZ_JEMALLOC_API void
-jemalloc_stats_impl(jemalloc_stats_t *stats)
-{
- unsigned narenas;
- size_t active, allocated, mapped, page, pdirty;
- size_t lg_chunk;
-
- // Refresh jemalloc's stats by updating its epoch, see ctl_refresh in
- // src/ctl.c
- uint64_t epoch = 0;
- size_t esz = sizeof(epoch);
- je_(mallctl)("epoch", &epoch, &esz, &epoch, esz);
-
- CTL_GET("arenas.narenas", narenas);
- CTL_GET("arenas.page", page);
- CTL_GET("stats.active", active);
- CTL_GET("stats.allocated", allocated);
- CTL_GET("stats.mapped", mapped);
- CTL_GET("opt.lg_chunk", lg_chunk);
-
- /* get the summation for all arenas, i == narenas */
- CTL_I_GET("stats.arenas.0.pdirty", pdirty, narenas);
-
- stats->chunksize = (size_t) 1 << lg_chunk;
- stats->mapped = mapped;
- stats->allocated = allocated;
- stats->waste = active - allocated;
- stats->page_cache = pdirty * page;
- compute_bin_unused_and_bookkeeping(stats, narenas);
- stats->waste -= stats->bin_unused;
-}
-
-MOZ_JEMALLOC_API void
-jemalloc_purge_freed_pages_impl()
-{
-}
-
-MOZ_JEMALLOC_API void
-jemalloc_free_dirty_pages_impl()
-{
- unsigned narenas;
- size_t mib[3];
- size_t miblen = sizeof(mib) / sizeof(mib[0]);
-
- CTL_GET("arenas.narenas", narenas);
- je_(mallctlnametomib)("arena.0.purge", mib, &miblen);
- mib[1] = narenas;
- je_(mallctlbymib)(mib, miblen, NULL, NULL, NULL, 0);
-}
diff --git a/memory/jemalloc/moz.build b/memory/jemalloc/moz.build
index b7e2b661f..e2c3f002e 100644
--- a/memory/jemalloc/moz.build
+++ b/memory/jemalloc/moz.build
@@ -46,10 +46,7 @@ if CONFIG['OS_TARGET'] == 'Darwin' and not CONFIG['MOZ_REPLACE_MALLOC']:
'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']:
SDK_LIBRARY = True
diff --git a/memory/moz.build b/memory/moz.build
index bdf262293..7f7559f3a 100644
--- a/memory/moz.build
+++ b/memory/moz.build
@@ -20,7 +20,7 @@ if CONFIG['MOZ_MEMORY']:
'mozjemalloc',
]
- if CONFIG['MOZ_JEMALLOC4'] or CONFIG['MOZ_REPLACE_MALLOC']:
+ if CONFIG['MOZ_REPLACE_MALLOC']:
DIRS += ['jemalloc']
if CONFIG['MOZ_REPLACE_MALLOC']:
diff --git a/memory/mozjemalloc/moz.build b/memory/mozjemalloc/moz.build
index 0660d1300..feeb4fb07 100644
--- a/memory/mozjemalloc/moz.build
+++ b/memory/mozjemalloc/moz.build
@@ -8,16 +8,15 @@ EXPORTS += [
'jemalloc_types.h',
]
-if not CONFIG['MOZ_JEMALLOC4']:
- 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']
+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']
# For non release/esr builds, enable (some) fatal jemalloc assertions. This
# helps us catch memory errors.
diff --git a/memory/replace/logalloc/replay/Replay.cpp b/memory/replace/logalloc/replay/Replay.cpp
index 30fcd21e5..0ae20de2c 100644
--- a/memory/replace/logalloc/replay/Replay.cpp
+++ b/memory/replace/logalloc/replay/Replay.cpp
@@ -286,7 +286,7 @@ MOZ_BEGIN_EXTERN_C
/* 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
@@ -475,7 +475,7 @@ main()
FdReader reader(0);
Replay replay;
-#if defined(_WIN32) && !defined(MOZ_JEMALLOC4)
+#if defined(_WIN32)
malloc_init_hard();
#endif
diff --git a/memory/replace/moz.build b/memory/replace/moz.build
index 111b8456b..1f29da7aa 100644
--- a/memory/replace/moz.build
+++ b/memory/replace/moz.build
@@ -9,9 +9,8 @@ DIRS += [
'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']
diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp
index aa3d74dfd..616eefbdc 100644
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -439,13 +439,11 @@ 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)) {