--- a/memory/mozjemalloc/mozjemalloc.cpp
+++ b/memory/mozjemalloc/mozjemalloc.cpp
@@ -1078,22 +1078,20 @@ static __thread arena_t *arenas_map;
const char *_malloc_options = MOZ_MALLOC_OPTIONS;
const uint8_t kAllocJunk = 0xe4;
const uint8_t kAllocPoison = 0xe5;
#ifndef MALLOC_PRODUCTION
static bool opt_abort = true;
static bool opt_junk = true;
-static bool opt_poison = true;
static bool opt_zero = false;
#else
static bool opt_abort = false;
static const bool opt_junk = false;
-static const bool opt_poison = true;
static const bool opt_zero = false;
#endif
static size_t opt_dirty_max = DIRTY_MAX_DEFAULT;
static bool opt_print_stats = false;
#ifdef MALLOC_STATIC_SIZES
#define opt_quantum_2pow QUANTUM_2POW_MIN
#define opt_small_max_2pow SMALL_MAX_2POW_DEFAULT
@@ -3911,18 +3909,17 @@ arena_dalloc_small(arena_t *arena, arena
arena_bin_t *bin;
size_t size;
run = (arena_run_t *)(mapelm->bits & ~pagesize_mask);
RELEASE_ASSERT(run->magic == ARENA_RUN_MAGIC);
bin = run->bin;
size = bin->reg_size;
- if (opt_poison)
- memset(ptr, kAllocPoison, size);
+ memset(ptr, kAllocPoison, size);
arena_run_reg_dalloc(run, bin, ptr, size);
run->nfree++;
if (run->nfree == bin->nregs) {
/* Deallocate run. */
if (run == bin->runcur)
bin->runcur = NULL;
@@ -3987,18 +3984,17 @@ arena_dalloc_small(arena_t *arena, arena
static void
arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, void *ptr)
{
size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >>
pagesize_2pow;
size_t size = chunk->map[pageind].bits & ~pagesize_mask;
- if (opt_poison)
- memset(ptr, kAllocPoison, size);
+ memset(ptr, kAllocPoison, size);
arena->stats.allocated_large -= size;
arena->stats.ndalloc_large++;
arena_run_dalloc(arena, (arena_run_t *)ptr, true);
}
static inline void
arena_dalloc(void *ptr, size_t offset)
@@ -4108,35 +4104,33 @@ arena_ralloc_large_grow(arena_t *arena,
static bool
arena_ralloc_large(void *ptr, size_t size, size_t oldsize)
{
size_t psize;
psize = PAGE_CEILING(size);
if (psize == oldsize) {
/* Same size class. */
- if (opt_poison && size < oldsize) {
+ if (size < oldsize) {
memset((void *)((uintptr_t)ptr + size), kAllocPoison, oldsize -
size);
}
return (false);
} else {
arena_chunk_t *chunk;
arena_t *arena;
chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
arena = chunk->arena;
RELEASE_ASSERT(arena->magic == ARENA_MAGIC);
if (psize < oldsize) {
/* Fill before shrinking in order avoid a race. */
- if (opt_poison) {
- memset((void *)((uintptr_t)ptr + size), kAllocPoison,
- oldsize - size);
- }
+ memset((void *)((uintptr_t)ptr + size), kAllocPoison,
+ oldsize - size);
arena_ralloc_large_shrink(arena, chunk, ptr, psize,
oldsize);
return (false);
} else {
bool ret = arena_ralloc_large_grow(arena, chunk, ptr,
psize, oldsize);
if (ret == false && opt_zero) {
memset((void *)((uintptr_t)ptr + oldsize), 0,
@@ -4189,17 +4183,17 @@ arena_ralloc(void *ptr, size_t size, siz
if (copysize >= VM_COPY_MIN)
pages_copy(ret, ptr, copysize);
else
#endif
memcpy(ret, ptr, copysize);
idalloc(ptr);
return (ret);
IN_PLACE:
- if (opt_poison && size < oldsize)
+ if (size < oldsize)
memset((void *)((uintptr_t)ptr + size), kAllocPoison, oldsize - size);
else if (opt_zero && size > oldsize)
memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize);
return (ptr);
}
static inline void *
iralloc(void *ptr, size_t size)
@@ -4459,17 +4453,17 @@ huge_ralloc(void *ptr, size_t size, size
void *ret;
size_t copysize;
/* Avoid moving the allocation if the size class would not change. */
if (oldsize > arena_maxclass &&
CHUNK_CEILING(size) == CHUNK_CEILING(oldsize)) {
size_t psize = PAGE_CEILING(size);
- if (opt_poison && size < oldsize) {
+ if (size < oldsize) {
memset((void *)((uintptr_t)ptr + size), kAllocPoison, oldsize
- size);
}
#ifdef MALLOC_DECOMMIT
if (psize < oldsize) {
extent_node_t *node, key;
pages_decommit((void *)((uintptr_t)ptr + psize),
@@ -4578,17 +4572,16 @@ malloc_print_stats(void)
#ifdef NDEBUG
"disabled",
#else
"enabled",
#endif
"\n", "");
_malloc_message("Boolean MALLOC_OPTIONS: ",
opt_abort ? "A" : "a", "", "");
- _malloc_message(opt_poison ? "C" : "c", "", "", "");
_malloc_message(opt_junk ? "J" : "j", "", "", "");
_malloc_message("P", "", "", "");
#ifdef MALLOC_SYSV
_malloc_message(opt_sysv ? "V" : "v", "", "", "");
#endif
#ifdef MALLOC_XMALLOC
_malloc_message(opt_xmalloc ? "X" : "x", "", "", "");
#endif
@@ -4847,24 +4840,16 @@ MALLOC_OUT:
for (k = 0; k < nreps; k++) {
switch (opts[j]) {
case 'a':
opt_abort = false;
break;
case 'A':
opt_abort = true;
break;
-#ifndef MALLOC_PRODUCTION
- case 'c':
- opt_poison = false;
- break;
- case 'C':
- opt_poison = true;
- break;
-#endif
case 'f':
opt_dirty_max >>= 1;
break;
case 'F':
if (opt_dirty_max == 0)
opt_dirty_max = 1;
else if ((opt_dirty_max << 1) != 0)
opt_dirty_max <<= 1;
@@ -5457,17 +5442,16 @@ jemalloc_stats_impl(jemalloc_stats_t *st
assert(stats != NULL);
/*
* Gather runtime settings.
*/
stats->opt_abort = opt_abort;
stats->opt_junk = opt_junk;
- stats->opt_poison = opt_poison;
stats->opt_sysv =
#ifdef MALLOC_SYSV
opt_sysv ? true :
#endif
false;
stats->opt_xmalloc =
#ifdef MALLOC_XMALLOC
opt_xmalloc ? true :