--- a/memory/mozjemalloc/mozjemalloc.cpp
+++ b/memory/mozjemalloc/mozjemalloc.cpp
@@ -127,21 +127,16 @@
*
* The jemalloc_purge_freed_pages definition in memory/build/mozmemory.h needs
* to be adjusted if MALLOC_DOUBLE_PURGE is ever enabled on Linux.
*/
#ifdef MOZ_MEMORY_DARWIN
#define MALLOC_DOUBLE_PURGE
#endif
-#ifdef MOZ_DEBUG
- /* Support optional abort() on OOM. */
-# define MALLOC_XMALLOC
-#endif
-
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -1021,19 +1016,16 @@ static bool opt_print_stats = false;
#define opt_quantum_2pow QUANTUM_2POW_MIN
#define opt_small_max_2pow SMALL_MAX_2POW_DEFAULT
#define opt_chunk_2pow CHUNK_2POW_DEFAULT
#else
static size_t opt_quantum_2pow = QUANTUM_2POW_MIN;
static size_t opt_small_max_2pow = SMALL_MAX_2POW_DEFAULT;
static size_t opt_chunk_2pow = CHUNK_2POW_DEFAULT;
#endif
-#ifdef MALLOC_XMALLOC
-static bool opt_xmalloc = false;
-#endif
/******************************************************************************/
/*
* Begin forward declarations.
*/
#ifdef MOZ_MEMORY_DARWIN
/* Avoid namespace collision with OS X's malloc APIs. */
@@ -4382,19 +4374,16 @@ malloc_print_stats(void)
#else
"enabled",
#endif
"\n", "");
_malloc_message("Boolean MALLOC_OPTIONS: ",
opt_abort ? "A" : "a", "", "");
_malloc_message(opt_junk ? "J" : "j", "", "", "");
_malloc_message("P", "", "", "");
-#ifdef MALLOC_XMALLOC
- _malloc_message(opt_xmalloc ? "X" : "x", "", "", "");
-#endif
_malloc_message(opt_zero ? "Z" : "z", "", "", "");
_malloc_message("\n", "", "", "");
_malloc_message("Max arenas: ", umax2s(narenas, s), "\n",
"");
_malloc_message("Pointer size: ", umax2s(sizeof(void *), s),
"\n", "");
_malloc_message("Quantum size: ", umax2s(quantum, s), "\n",
@@ -4647,24 +4636,16 @@ MALLOC_OUT:
opt_small_max_2pow--;
break;
case 'S':
if (opt_small_max_2pow < pagesize_2pow
- 1)
opt_small_max_2pow++;
break;
#endif
-#ifdef MALLOC_XMALLOC
- case 'x':
- opt_xmalloc = false;
- break;
- case 'X':
- opt_xmalloc = true;
- break;
-#endif
#ifdef MOZ_DEBUG
case 'z':
opt_zero = false;
break;
case 'Z':
opt_zero = true;
break;
#endif
@@ -4831,24 +4812,16 @@ malloc_impl(size_t size)
if (size == 0) {
size = 1;
}
ret = imalloc(size);
RETURN:
if (ret == NULL) {
-#ifdef MALLOC_XMALLOC
- if (opt_xmalloc) {
- _malloc_message(_getprogname(),
- ": (malloc) Error in malloc(): out of memory\n", "",
- "");
- moz_abort();
- }
-#endif
errno = ENOMEM;
}
return (ret);
}
/*
* In ELF systems the default visibility allows symbols to be preempted at
@@ -4889,46 +4862,31 @@ MEMALIGN(size_t alignment, size_t size)
if (size == 0) {
size = 1;
}
alignment = alignment < sizeof(void*) ? sizeof(void*) : alignment;
ret = ipalloc(alignment, size);
RETURN:
-#ifdef MALLOC_XMALLOC
- if (opt_xmalloc && ret == NULL) {
- _malloc_message(_getprogname(),
- ": (malloc) Error in memalign(): out of memory\n", "", "");
- moz_abort();
- }
-#endif
return (ret);
}
#ifdef MOZ_MEMORY_ELF
extern void *
memalign_impl(size_t alignment, size_t size) __attribute__((alias ("memalign_internal"), visibility ("default")));
#endif
MOZ_MEMORY_API int
posix_memalign_impl(void **memptr, size_t alignment, size_t size)
{
void *result;
/* Make sure that alignment is a large enough power of 2. */
if (((alignment - 1) & alignment) != 0 || alignment < sizeof(void *)) {
-#ifdef MALLOC_XMALLOC
- if (opt_xmalloc) {
- _malloc_message(_getprogname(),
- ": (malloc) Error in posix_memalign(): "
- "invalid alignment\n", "", "");
- moz_abort();
- }
-#endif
return (EINVAL);
}
/* The 0-->1 size promotion is done in the memalign() call below */
result = MEMALIGN(alignment, size);
if (result == NULL)
@@ -4937,24 +4895,16 @@ posix_memalign_impl(void **memptr, size_
*memptr = result;
return (0);
}
MOZ_MEMORY_API void *
aligned_alloc_impl(size_t alignment, size_t size)
{
if (size % alignment) {
-#ifdef MALLOC_XMALLOC
- if (opt_xmalloc) {
- _malloc_message(_getprogname(),
- ": (malloc) Error in aligned_alloc(): "
- "size is not multiple of alignment\n", "", "");
- moz_abort();
- }
-#endif
return (NULL);
}
return MEMALIGN(alignment, size);
}
MOZ_MEMORY_API void *
valloc_impl(size_t size)
{
@@ -4987,24 +4937,16 @@ calloc_impl(size_t num, size_t size)
ret = NULL;
goto RETURN;
}
ret = icalloc(num_size);
RETURN:
if (ret == NULL) {
-#ifdef MALLOC_XMALLOC
- if (opt_xmalloc) {
- _malloc_message(_getprogname(),
- ": (malloc) Error in calloc(): out of memory\n", "",
- "");
- moz_abort();
- }
-#endif
errno = ENOMEM;
}
return (ret);
}
MOZ_MEMORY_API void *
realloc_impl(void *ptr, size_t size)
@@ -5016,41 +4958,25 @@ realloc_impl(void *ptr, size_t size)
}
if (ptr != NULL) {
MOZ_ASSERT(malloc_initialized);
ret = iralloc(ptr, size);
if (ret == NULL) {
-#ifdef MALLOC_XMALLOC
- if (opt_xmalloc) {
- _malloc_message(_getprogname(),
- ": (malloc) Error in realloc(): out of "
- "memory\n", "", "");
- moz_abort();
- }
-#endif
errno = ENOMEM;
}
} else {
if (malloc_init())
ret = NULL;
else
ret = imalloc(size);
if (ret == NULL) {
-#ifdef MALLOC_XMALLOC
- if (opt_xmalloc) {
- _malloc_message(_getprogname(),
- ": (malloc) Error in realloc(): out of "
- "memory\n", "", "");
- moz_abort();
- }
-#endif
errno = ENOMEM;
}
}
return (ret);
}
MOZ_MEMORY_API void
@@ -5131,21 +5057,16 @@ jemalloc_stats_impl(jemalloc_stats_t *st
MOZ_ASSERT(stats != NULL);
/*
* Gather runtime settings.
*/
stats->opt_abort = opt_abort;
stats->opt_junk = opt_junk;
- stats->opt_xmalloc =
-#ifdef MALLOC_XMALLOC
- opt_xmalloc ? true :
-#endif
- false;
stats->opt_zero = opt_zero;
stats->narenas = narenas;
stats->quantum = quantum;
stats->small_max = small_max;
stats->large_max = arena_maxclass;
stats->chunksize = chunksize;
stats->dirty_max = opt_dirty_max;