Commit 609e12c7 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 738176 - Completely disable jemalloc when it's supposed to be disabled on...

Bug 738176 - Completely disable jemalloc when it's supposed to be disabled on OSX, and cleanup exposed APIs. r=jlebar,r=khuey
parent 6fb367bf
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -7214,13 +7214,6 @@ else
    AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
    ;;
  esac

  if test "$OS_ARCH" != "WINNT"; then
    dnl NB: this must be kept in sync with jemalloc.h
    AC_DEFINE(HAVE_JEMALLOC_VALLOC)
  fi
  AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
  AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
fi # MOZ_MEMORY
AC_SUBST(MOZ_MEMORY)
AC_SUBST(MOZ_GLUE_LDFLAGS)
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ static void*
TryAllocAlignedBytes(size_t aSize)
{
    // Use fallible allocators here
#if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_JEMALLOC_POSIX_MEMALIGN)
#if defined(HAVE_POSIX_MEMALIGN)
    void* ptr;
    // Try to align for fast alpha recovery.  This should only help
    // cairo too, can't hurt.
+0 −4
Original line number Diff line number Diff line
@@ -19,10 +19,6 @@
#include "base/string_tokenizer.h"
#include "base/string_util.h"

#ifdef MOZ_MEMORY_ANDROID
#include "jemalloc.h"
#endif

namespace {

enum ParsingState {
+0 −7
Original line number Diff line number Diff line
@@ -4088,13 +4088,6 @@ if test "$MOZ_MEMORY"; then
    AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
    ;;
  esac

  if test "$OS_ARCH" != "Darwin"; then
    dnl NB: this must be kept in sync with jemalloc.h
    AC_DEFINE(HAVE_JEMALLOC_VALLOC)
    AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
    AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
  fi
fi
AC_SUBST(MOZ_MEMORY)
AC_SUBST(MOZ_GLUE_LDFLAGS)
+9 −4
Original line number Diff line number Diff line
@@ -123,6 +123,8 @@
 * jemalloc_purge_freed_pages(), which will force the OS to release those
 * MADV_FREE'd pages, making the process's RSS reflect its true memory usage.
 *
 * The jemalloc_purge_freed_pages definition in jemalloc.h needs to be
 * adjusted if MALLOC_DOUBLE_PURGE is ever enabled on Linux.
 */
#ifdef MOZ_MEMORY_DARWIN
#define MALLOC_DOUBLE_PURGE
@@ -374,7 +376,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/malloc.c 180599 2008-07-18 19:35:44Z ja

#endif

#include "jemalloc.h"
#include "jemalloc_types.h"
#include "linkedlist.h"

/* Some tools, such as /dev/dsp wrappers, LD_PRELOAD libraries that
@@ -6550,8 +6552,11 @@ free(void *ptr)
 */

/* This was added by Mozilla for use by SQLite. */
#ifdef MOZ_MEMORY_DARWIN
static
#endif
size_t
je_malloc_usable_size_in_advance(size_t size)
je_malloc_good_size(size_t size)
{
	/*
	 * This duplicates the logic in imalloc(), arena_malloc() and
@@ -6581,7 +6586,7 @@ je_malloc_usable_size_in_advance(size_t size)
		 * Huge.  We use PAGE_CEILING to get psize, instead of using
		 * CHUNK_CEILING to get csize.  This ensures that this
		 * malloc_usable_size(malloc(n)) always matches
		 * je_malloc_usable_size_in_advance(n).
		 * je_malloc_good_size(n).
		 */
		size = PAGE_CEILING(size);
	}
@@ -6915,7 +6920,7 @@ zone_destroy(malloc_zone_t *zone)
static size_t
zone_good_size(malloc_zone_t *zone, size_t size)
{
	return je_malloc_usable_size_in_advance(size);
	return je_malloc_good_size(size);
}

static size_t
Loading