Loading build/unix/gnu-ld-scripts/jemalloc-standalone-linkage-version-script +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ _malloc_prefork; jemalloc_stats; malloc_usable_size; je_malloc_usable_size_in_advance; posix_memalign; free; realloc; Loading memory/jemalloc/jemalloc.c +41 −0 Original line number Diff line number Diff line Loading @@ -6495,6 +6495,47 @@ free(void *ptr) /* * Begin non-standard functions. */ /* This was added by Mozilla for use by SQLite. */ size_t je_malloc_usable_size_in_advance(size_t size) { /* * This duplicates the logic in imalloc(), arena_malloc() and * arena_malloc_small(). */ if (size < small_min) { /* Small (tiny). */ size = pow2_ceil(size); /* * We omit the #ifdefs from arena_malloc_small() -- * it can be inaccurate with its size in some cases, but this * function must be accurate. */ if (size < (1U << TINY_MIN_2POW)) size = (1U << TINY_MIN_2POW); } else if (size <= small_max) { /* Small (quantum-spaced). */ size = QUANTUM_CEILING(size); } else if (size <= bin_maxclass) { /* Small (sub-page). */ size = pow2_ceil(size); } else if (size <= arena_maxclass) { /* Large. */ size = PAGE_CEILING(size); } else { /* * 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). */ size = PAGE_CEILING(size); } return size; } #ifdef MOZ_MEMORY_ANDROID size_t malloc_usable_size(void *ptr) Loading memory/jemalloc/jemalloc.h +3 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,9 @@ size_t malloc_usable_size(const void *ptr); void jemalloc_stats(jemalloc_stats_t *stats); /* Computes the usable size in advance. */ size_t je_malloc_usable_size_in_advance(size_t size); /* * On some operating systems (Mac), we use madvise(MADV_FREE) to hand pages * back to the operating system. On Mac, the operating system doesn't take Loading memory/mozutils/mozutils.def.in +1 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ EXPORTS wcsdup=je_wcsdup _wcsdup=je_wcsdup malloc_usable_size=je_malloc_usable_size je_malloc_usable_size_in_advance jemalloc_stats ; A hack to work around the CRT (see giant comment in Makefile.in) frex=je_dumb_free_thunk Loading storage/src/Makefile.in +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,10 @@ FORCE_STATIC_LIB = 1 GRE_MODULE = 1 LIBXUL_LIBRARY = 1 # TODO: we do this in crashreporter and xpcom/base too, should be centralized ifeq ($(OS_ARCH),Linux) DEFINES += -DXP_LINUX endif EXPORTS_NAMESPACES = mozilla/storage Loading Loading
build/unix/gnu-ld-scripts/jemalloc-standalone-linkage-version-script +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ _malloc_prefork; jemalloc_stats; malloc_usable_size; je_malloc_usable_size_in_advance; posix_memalign; free; realloc; Loading
memory/jemalloc/jemalloc.c +41 −0 Original line number Diff line number Diff line Loading @@ -6495,6 +6495,47 @@ free(void *ptr) /* * Begin non-standard functions. */ /* This was added by Mozilla for use by SQLite. */ size_t je_malloc_usable_size_in_advance(size_t size) { /* * This duplicates the logic in imalloc(), arena_malloc() and * arena_malloc_small(). */ if (size < small_min) { /* Small (tiny). */ size = pow2_ceil(size); /* * We omit the #ifdefs from arena_malloc_small() -- * it can be inaccurate with its size in some cases, but this * function must be accurate. */ if (size < (1U << TINY_MIN_2POW)) size = (1U << TINY_MIN_2POW); } else if (size <= small_max) { /* Small (quantum-spaced). */ size = QUANTUM_CEILING(size); } else if (size <= bin_maxclass) { /* Small (sub-page). */ size = pow2_ceil(size); } else if (size <= arena_maxclass) { /* Large. */ size = PAGE_CEILING(size); } else { /* * 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). */ size = PAGE_CEILING(size); } return size; } #ifdef MOZ_MEMORY_ANDROID size_t malloc_usable_size(void *ptr) Loading
memory/jemalloc/jemalloc.h +3 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,9 @@ size_t malloc_usable_size(const void *ptr); void jemalloc_stats(jemalloc_stats_t *stats); /* Computes the usable size in advance. */ size_t je_malloc_usable_size_in_advance(size_t size); /* * On some operating systems (Mac), we use madvise(MADV_FREE) to hand pages * back to the operating system. On Mac, the operating system doesn't take Loading
memory/mozutils/mozutils.def.in +1 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ EXPORTS wcsdup=je_wcsdup _wcsdup=je_wcsdup malloc_usable_size=je_malloc_usable_size je_malloc_usable_size_in_advance jemalloc_stats ; A hack to work around the CRT (see giant comment in Makefile.in) frex=je_dumb_free_thunk Loading
storage/src/Makefile.in +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,10 @@ FORCE_STATIC_LIB = 1 GRE_MODULE = 1 LIBXUL_LIBRARY = 1 # TODO: we do this in crashreporter and xpcom/base too, should be centralized ifeq ($(OS_ARCH),Linux) DEFINES += -DXP_LINUX endif EXPORTS_NAMESPACES = mozilla/storage Loading