Update to jemalloc 4.4.0.
Merge remote-tracking branch 'aosp/upstream-new' into upgrade
Includes regenerating the necessary files.
Bug: 33321361
Test: Built for x86_64/arm64. Built the no tcache and tcache enabled
Test: configs (nexus 9/nexus 6p). Compared the before after running
Test: all dumps through the memory replay and verified no unexpected
Test: increases. Ran bionic unit tests in both configs, 32 bit and 64 bit
Test: variants. Ran the jemalloc unit tests in both configs.
Change-Id: I2e8f3305cd1717c7efced69718fff90797f21068
diff --git a/.gitignore b/.gitignore
index 08278d0..26d3531 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,31 +21,11 @@
/Makefile
-/include/jemalloc/internal/jemalloc_internal.h
-/include/jemalloc/internal/jemalloc_internal_defs.h
-/include/jemalloc/internal/private_namespace.h
-/include/jemalloc/internal/private_unnamespace.h
-/include/jemalloc/internal/public_namespace.h
-/include/jemalloc/internal/public_symbols.txt
-/include/jemalloc/internal/public_unnamespace.h
-/include/jemalloc/internal/size_classes.h
-/include/jemalloc/jemalloc.h
-/include/jemalloc/jemalloc_defs.h
-/include/jemalloc/jemalloc_macros.h
-/include/jemalloc/jemalloc_mangle.h
-/include/jemalloc/jemalloc_mangle_jet.h
-/include/jemalloc/jemalloc_protos.h
-/include/jemalloc/jemalloc_protos_jet.h
-/include/jemalloc/jemalloc_rename.h
-/include/jemalloc/jemalloc_typedefs.h
-
/src/*.[od]
/src/*.gcda
/src/*.gcno
/test/test.sh
-test/include/test/jemalloc_test.h
-test/include/test/jemalloc_test_defs.h
/test/integration/[A-Za-z]*
!/test/integration/[A-Za-z]*.*
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..5718add
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,335 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+common_cflags = [
+ "-D_REENTRANT",
+ "-fvisibility=hidden",
+ "-Wno-unused-parameter",
+ "-Wno-type-limits",
+]
+
+// These parameters change the way jemalloc works.
+// ANDROID_MAX_ARENAS=XX
+// The total number of arenas will be less than or equal to this number.
+// The number of arenas will be calculated as 2 * the number of cpus
+// but no larger than XX.
+// ANDROID_TCACHE_NSLOTS_SMALL_MAX=XX
+// The number of small slots held in the tcache. The higher this number
+// is, the higher amount of PSS consumed. If this number is set too low
+// then small allocations will take longer to complete.
+// ANDROID_TCACHE_NSLOTS_LARGE=XX
+// The number of large slots held in the tcache. The higher this number
+// is, the higher amount of PSS consumed. If this number is set too low
+// then large allocations will take longer to complete.
+// ANDROID_LG_TCACHE_MAXCLASS_DEFAULT=XX
+// 1 << XX is the maximum sized allocation that will be in the tcache.
+// ANDROID_LG_CHUNK_DEFAULT=XX
+// 1 << XX is the default chunk size used by the system. Decreasing this
+// usually decreases the amount of PSS used, but can increase
+// fragmentation.
+
+// Default to a single arena for svelte configurations to minimize
+// PSS consumed by jemalloc.
+common_cflags += [
+ "-DANDROID_MAX_ARENAS=1",
+ "-DANDROID_LG_TCACHE_MAXCLASS_DEFAULT=16",
+]
+
+common_c_local_includes = [
+ "src",
+ "include",
+]
+
+common_product_variables = {
+ // Only enable the tcache on non-svelte configurations, to save PSS.
+ malloc_not_svelte: {
+ cflags: [
+ "-UANDROID_MAX_ARENAS",
+ "-DANDROID_MAX_ARENAS=2",
+ "-DJEMALLOC_TCACHE",
+ "-DANDROID_TCACHE_NSLOTS_SMALL_MAX=8",
+ "-DANDROID_TCACHE_NSLOTS_LARGE=16",
+ ],
+ },
+}
+
+cc_defaults {
+ name: "jemalloc_defaults",
+ defaults: ["linux_bionic_supported"],
+ cflags: common_cflags,
+
+ product_variables: common_product_variables,
+
+ multilib: {
+ lib32: {
+ // Use a 512K chunk size on 32 bit systems.
+ // This keeps the total amount of virtual address space consumed
+ // by jemalloc lower.
+ cflags: [
+ "-DANDROID_LG_CHUNK_DEFAULT=19",
+ ],
+ },
+ lib64: {
+ // Use a 2MB chunk size on 64 bit systems.
+ // This is the default currently used by 4.0.0
+ cflags: [
+ "-DANDROID_LG_CHUNK_DEFAULT=21",
+ ],
+ },
+ },
+
+ local_include_dirs: common_c_local_includes,
+ stl: "none",
+}
+
+lib_src_files = [
+ "src/arena.c",
+ "src/atomic.c",
+ "src/base.c",
+ "src/bitmap.c",
+ "src/chunk.c",
+ "src/chunk_dss.c",
+ "src/chunk_mmap.c",
+ "src/ckh.c",
+ "src/ctl.c",
+ "src/extent.c",
+ "src/hash.c",
+ "src/huge.c",
+ "src/jemalloc.c",
+ "src/mb.c",
+ "src/mutex.c",
+ "src/nstime.c",
+ "src/pages.c",
+ "src/prng.c",
+ "src/prof.c",
+ "src/quarantine.c",
+ "src/rtree.c",
+ "src/spin.c",
+ "src/stats.c",
+ "src/tcache.c",
+ "src/ticker.c",
+ "src/tsd.c",
+ "src/util.c",
+ "src/witness.c",
+]
+
+//-----------------------------------------------------------------------
+// jemalloc static library
+//-----------------------------------------------------------------------
+cc_library_static {
+ name: "libjemalloc",
+
+ defaults: ["jemalloc_defaults"],
+
+ cflags: ["-include bionic/libc/private/libc_logging.h"],
+
+ srcs: lib_src_files,
+}
+
+//-----------------------------------------------------------------------
+// jemalloc static jet library
+//-----------------------------------------------------------------------
+cc_library_static {
+ name: "libjemalloc_jet",
+
+ defaults: ["jemalloc_defaults"],
+
+ cflags: [
+ "-DJEMALLOC_JET",
+ "-include android/include/libc_logging.h",
+ ],
+
+ srcs: lib_src_files,
+
+}
+
+jemalloc_testlib_srcs = [
+ "test/src/btalloc.c",
+ "test/src/btalloc_0.c",
+ "test/src/btalloc_1.c",
+ "test/src/math.c",
+ "test/src/mq.c",
+ "test/src/mtx.c",
+ "test/src/SFMT.c",
+ "test/src/test.c",
+ "test/src/thd.c",
+ "test/src/timer.c",
+]
+
+//-----------------------------------------------------------------------
+// jemalloc unit test library
+//-----------------------------------------------------------------------
+cc_library_static {
+ name: "libjemalloc_unittest",
+
+ defaults: ["jemalloc_defaults"],
+
+ cflags: [
+ "-DJEMALLOC_UNIT_TEST",
+ "-include android/include/libc_logging.h",
+ ],
+
+ local_include_dirs: [
+ "test/src",
+ "test/include",
+ ],
+
+ srcs: jemalloc_testlib_srcs,
+
+ whole_static_libs: ["libjemalloc_jet"],
+
+}
+
+//-----------------------------------------------------------------------
+// jemalloc unit tests
+//-----------------------------------------------------------------------
+unit_tests = [
+ "test/unit/a0.c",
+ "test/unit/arena_reset.c",
+ "test/unit/atomic.c",
+ "test/unit/bitmap.c",
+ "test/unit/ckh.c",
+ "test/unit/decay.c",
+ "test/unit/fork.c",
+ "test/unit/hash.c",
+ "test/unit/junk.c",
+ "test/unit/junk_alloc.c",
+ "test/unit/junk_free.c",
+ "test/unit/lg_chunk.c",
+ "test/unit/mallctl.c",
+ "test/unit/math.c",
+ "test/unit/mq.c",
+ "test/unit/mtx.c",
+ "test/unit/nstime.c",
+ "test/unit/pack.c",
+ "test/unit/pages.c",
+ "test/unit/prng.c",
+ "test/unit/prof_accum.c",
+ "test/unit/prof_active.c",
+ "test/unit/prof_gdump.c",
+ "test/unit/prof_idump.c",
+ "test/unit/prof_reset.c",
+ "test/unit/prof_thread_name.c",
+ "test/unit/ql.c",
+ "test/unit/qr.c",
+ "test/unit/quarantine.c",
+ "test/unit/rb.c",
+ "test/unit/rtree.c",
+ "test/unit/run_quantize.c",
+ "test/unit/SFMT.c",
+ "test/unit/size_classes.c",
+ "test/unit/smoothstep.c",
+ "test/unit/stats.c",
+ "test/unit/ticker.c",
+ "test/unit/tsd.c",
+ "test/unit/util.c",
+ "test/unit/witness.c",
+ "test/unit/zero.c",
+]
+
+cc_test {
+ name: "jemalloc_unittests",
+
+ gtest: false,
+
+ product_variables: common_product_variables,
+
+ cflags: common_cflags + [
+ "-DJEMALLOC_UNIT_TEST",
+ "-include android/include/libc_logging.h",
+ ],
+
+ local_include_dirs: common_c_local_includes + [
+ "test/src",
+ "test/include",
+ ],
+
+ srcs: unit_tests,
+
+ static_libs: ["libjemalloc_unittest"],
+
+ shared_libs: ["liblog"],
+
+ test_per_src: true,
+}
+
+//-----------------------------------------------------------------------
+// jemalloc integration test library
+//-----------------------------------------------------------------------
+cc_library_static {
+ name: "libjemalloc_integrationtest",
+
+ defaults: ["jemalloc_defaults"],
+
+ cflags: [
+ "-DJEMALLOC_INTEGRATION_TEST",
+ "-include android/include/libc_logging.h",
+ ],
+
+ local_include_dirs: [
+ "test/src",
+ "test/include",
+ ],
+
+ srcs: jemalloc_testlib_srcs + lib_src_files,
+
+}
+
+//-----------------------------------------------------------------------
+// jemalloc integration tests
+//-----------------------------------------------------------------------
+integration_tests = [
+ "test/integration/aligned_alloc.c",
+ "test/integration/allocated.c",
+ "test/integration/chunk.c",
+ "test/integration/iterate.c",
+ "test/integration/MALLOCX_ARENA.c",
+ "test/integration/mallocx.c",
+ "test/integration/overflow.c",
+ "test/integration/posix_memalign.c",
+ "test/integration/rallocx.c",
+ "test/integration/sdallocx.c",
+ "test/integration/thread_arena.c",
+ "test/integration/thread_tcache_enabled.c",
+ "test/integration/xallocx.c",
+]
+
+cc_test {
+
+ name: "jemalloc_integrationtests",
+
+ gtest: false,
+
+ product_variables: common_product_variables,
+
+ cflags: common_cflags + [
+ "-DJEMALLOC_INTEGRATION_TEST",
+ "-include android/include/libc_logging.h",
+ ],
+
+ local_include_dirs: common_c_local_includes + [
+ "test/src",
+ "test/include",
+ ],
+
+ srcs: integration_tests,
+
+ static_libs: ["libjemalloc_integrationtest"],
+
+ shared_libs: ["liblog"],
+
+ test_per_src: true,
+}
diff --git a/MODULE_LICENSE_BSD b/MODULE_LICENSE_BSD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..bdda0fe
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,27 @@
+Unless otherwise specified, files in the jemalloc source distribution are
+subject to the following license:
+--------------------------------------------------------------------------------
+Copyright (C) 2002-2014 Jason Evans <jasone@canonware.com>.
+All rights reserved.
+Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
+Copyright (C) 2009-2014 Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+1. Redistributions of source code must retain the above copyright notice(s),
+ this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice(s),
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+--------------------------------------------------------------------------------
diff --git a/android/include/libc_logging.h b/android/include/libc_logging.h
new file mode 100644
index 0000000..19c2cfe
--- /dev/null
+++ b/android/include/libc_logging.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _JEMALLOC_LIBC_LOGGING_H
+#define _JEMALLOC_LIBC_LOGGING_H
+
+/* Convert this to an abort for jemalloc tests. */
+#define __libc_fatal(format, ...) abort()
+
+#endif /* _JEMALLOC_LIBC_LOGGING_H */
diff --git a/android/scripts/README b/android/scripts/README
new file mode 100644
index 0000000..3bccab2
--- /dev/null
+++ b/android/scripts/README
@@ -0,0 +1,41 @@
+There are configure scripts in this directory to generate the header files
+used by the jemalloc library.
+
+These scripts are named conf_<HOST_TYPE>.sh, where HOST_TYPE is one of
+aarch64, arm, mips, x86, x86_64.
+
+In order to build generate the header files for each supported HOST_TYPE,
+follow these steps:
+
+- source build/envsetup.sh
+- lunch <TARGET>
+- mmma -jXX bionic
+- cd external/jemalloc
+- autoconf
+- <Modify the configure script>
+- android/conf_<HOST_TYPE>.sh
+
+Follow these instructions to modify the configure script before running
+any of the conf_<HOST_TYPE>.sh scripts.
+
+In the code that looks similar to this:
+
+case "${host}" in
+ *-*-darwin*)
+
+Modify it to be:
+
+case "${host}" in
+ *android*)
+ CFLAGS="$CFLAGS"
+ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+ abi="elf"
+ force_tls="0"
+ enable_tls="0"
+ $as_echo "#define JEMALLOC_HAS_ALLOCA_H 1" >>confdefs.h
+
+ $as_echo "#define JEMALLOC_PURGE_MADVISE_DONTNEED " >>confdefs.h
+
+ $as_echo "#define JEMALLOC_THREADED_INIT " >>confdefs.h
+ ;;
+ *-*-darwin*)
diff --git a/android/scripts/conf_arm.sh b/android/scripts/conf_arm.sh
new file mode 100755
index 0000000..2888c13
--- /dev/null
+++ b/android/scripts/conf_arm.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+if [[ "$OUT" == "" ]]; then
+ echo "In order for this script to function, please choose an arm target"
+ echo "using source build/envsetup.sh and lunch XXX\n"
+ exit 1
+fi
+
+arm_cc="${ANDROID_TOOLCHAIN}/arm-linux-androideabi-gcc"
+arm_cpp="${ANDROID_TOOLCHAIN}/arm-linux-androideabi-g++"
+
+includes=(
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/arch-arm/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libstdc++/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi/asm-arm"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/android/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include/arm"
+)
+
+# Copy libm.so to libpthread.so to allow -lpthread to work.
+cp ${OUT}/obj/lib/libm.so ${OUT}/obj/lib/libpthread.so
+
+ldflags=(
+ "-nostdlib"
+ "-Bdynamic"
+ "-fPIE"
+ "-pie"
+ "-Wl,-dynamic-linker,/system/bin/linker"
+ "-Wl,--gc-sections"
+ "-Wl,-z,nocopyreloc"
+ "-L${OUT}/obj/lib"
+ "-Wl,-rpath-link=${OUT}/obj/lib"
+ "${OUT}/obj/lib/crtbegin_dynamic.o"
+ "-Wl,--whole-archive"
+ "-Wl,--no-whole-archive"
+ "-lc"
+ "-lstdc++"
+ "-lgcc"
+ "-lm"
+ "-Wl,-z,noexecstack"
+ "-Wl,-z,relro"
+ "-Wl,-z,now"
+ "-Wl,--warn-shared-textrel"
+ "-Wl,--fatal-warnings"
+ "-Wl,--icf=safe"
+ "-Wl,--no-undefined"
+ "-ldl"
+)
+
+eval ./configure CC=\"${arm_cc} ${includes[@]}\" \
+ CPP=\"${arm_cc} ${includes[@]} -E\" \
+ CXX=\"${arm_cpp} ${includes[@]}\" \
+ CXXCPP=\"${arm_cpp} ${includes[@]} -E\" \
+ LDFLAGS=\"${ldflags[@]}\" \
+ --host=arm-android-linux \
+ --disable-valgrind \
+ --with-jemalloc_prefix=je_ \
+
diff --git a/android/scripts/conf_arm64.sh b/android/scripts/conf_arm64.sh
new file mode 100755
index 0000000..02d4b50
--- /dev/null
+++ b/android/scripts/conf_arm64.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+if [[ "$OUT" == "" ]]; then
+ echo "In order for this script to function, please choose an arm64 target"
+ echo "using source build/envsetup.sh and lunch XXX\n"
+ exit 1
+fi
+
+aarch64_cc="${ANDROID_TOOLCHAIN}/aarch64-linux-android-gcc"
+aarch64_cpp="${ANDROID_TOOLCHAIN}/aarch64-linux-android-g++"
+
+includes=(
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/arch-arm64/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libstdc++/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi/asm-arm64"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/android/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include/arm64"
+)
+
+# Copy libm.so to libpthread.so to allow -lpthread to work.
+cp ${OUT}/obj/lib/libm.so ${OUT}/obj/lib/libpthread.so
+
+ldflags=(
+ "-nostdlib"
+ "-Bdynamic"
+ "-fPIE"
+ "-pie"
+ "-Wl,-dynamic-linker,/system/bin/linker64"
+ "-Wl,--gc-sections"
+ "-Wl,-z,nocopyreloc"
+ "-L${OUT}/obj/lib"
+ "-Wl,-rpath-link=${OUT}/obj/lib"
+ "${OUT}/obj/lib/crtbegin_dynamic.o"
+ "-Wl,--whole-archive"
+ "-Wl,--no-whole-archive"
+ "-lc"
+ "-lstdc++"
+ "-lgcc"
+ "-lm"
+ "-Wl,-z,noexecstack"
+ "-Wl,-z,relro"
+ "-Wl,-z,now"
+ "-Wl,--warn-shared-textrel"
+ "-Wl,--fatal-warnings"
+ "-Wl,--no-undefined"
+ "-ldl"
+)
+
+eval ./configure CC=\"${aarch64_cc} ${includes[@]}\" \
+ CPP=\"${aarch64_cc} ${includes[@]} -E\" \
+ CXX=\"${aarch64_cpp} ${includes[@]}\" \
+ CXXCPP=\"${aarch64_cpp} ${includes[@]} -E\" \
+ LDFLAGS=\"${ldflags[@]}\" \
+ --host=aarch64-android-linux \
+ --disable-valgrind \
+ --with-jemalloc_prefix=je_ \
+
diff --git a/android/scripts/conf_mips.sh b/android/scripts/conf_mips.sh
new file mode 100755
index 0000000..17ed3ee
--- /dev/null
+++ b/android/scripts/conf_mips.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+if [[ "$OUT" == "" ]]; then
+ echo "In order for this script to function, please choose an mips target"
+ echo "using source build/envsetup.sh and lunch XXX\n"
+ exit 1
+fi
+
+mips_cc="${ANDROID_TOOLCHAIN}/mipsel-linux-android-gcc"
+mips_cpp="${ANDROID_TOOLCHAIN}/mipsel-linux-android-g++"
+
+includes=(
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/arch-mips/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libstdc++/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi/asm-mips"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include/mips"
+)
+
+# Copy libm.so to libpthread.so to allow -lpthread to work.
+cp ${OUT}/obj/lib/libm.so ${OUT}/obj/lib/libpthread.so
+
+ldflags=(
+ "-nostdlib"
+ "-Bdynamic"
+ "-fPIE"
+ "-pie"
+ "-Wl,-dynamic-linker,/system/bin/linker"
+ "-Wl,--gc-sections"
+ "-Wl,-z,nocopyreloc"
+ "-L${OUT}/obj/lib"
+ "-Wl,-rpath-link=${OUT}/obj/lib"
+ "${OUT}/obj/lib/crtbegin_dynamic.o"
+ "-Wl,--whole-archive"
+ "-Wl,--no-whole-archive"
+ "-lc"
+ "-lstdc++"
+ "-lgcc"
+ "-lm"
+ "-Wl,-z,noexecstack"
+ "-Wl,-z,relro"
+ "-Wl,-z,now"
+ "-Wl,--warn-shared-textrel"
+ "-Wl,--fatal-warnings"
+ "-Wl,--no-undefined"
+ "-ldl"
+)
+
+eval ./configure CC=\"${mips_cc} ${includes[@]}\" \
+ CPP=\"${mips_cc} ${includes[@]} -E\" \
+ CXX=\"${mips_cpp} ${includes[@]}\" \
+ CXXCPP=\"${mips_cpp} ${includes[@]} -E\" \
+ LDFLAGS=\"${ldflags[@]}\" \
+ --host=mips-android-linux \
+ --disable-valgrind \
+ --with-jemalloc_prefix=je_ \
+
diff --git a/android/scripts/conf_x86.sh b/android/scripts/conf_x86.sh
new file mode 100755
index 0000000..434b5b9
--- /dev/null
+++ b/android/scripts/conf_x86.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+if [[ "$OUT" == "" ]]; then
+ echo "In order for this script to function, please choose an x86 target"
+ echo "using source build/envsetup.sh and lunch XXX\n"
+ exit 1
+fi
+
+x86_cc="${ANDROID_TOOLCHAIN}/x86_64-linux-android-gcc -m32"
+x86_cpp="${ANDROID_TOOLCHAIN}/x86_64-linux-android-g++ -m32"
+
+includes=(
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/arch-x86/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libstdc++/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi/asm-x86"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/android/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include/i387"
+)
+
+# Copy libm.so to libpthread.so to allow -lpthread to work.
+cp ${OUT}/obj/lib/libm.so ${OUT}/obj/lib/libpthread.so
+
+ldflags=(
+ "-nostdlib"
+ "-Bdynamic"
+ "-fPIE"
+ "-pie"
+ "-Wl,-dynamic-linker,/system/bin/linker"
+ "-Wl,--gc-sections"
+ "-Wl,-z,nocopyreloc"
+ "-L${OUT}/obj/lib"
+ "-Wl,-rpath-link=${OUT}/obj/lib"
+ "${OUT}/obj/lib/crtbegin_dynamic.o"
+ "-Wl,--whole-archive"
+ "-Wl,--no-whole-archive"
+ "-lc"
+ "-lstdc++"
+ "-lgcc"
+ "-lm"
+ "-Wl,-z,noexecstack"
+ "-Wl,-z,relro"
+ "-Wl,-z,now"
+ "-Wl,--warn-shared-textrel"
+ "-Wl,--fatal-warnings"
+ "-Wl,--icf=safe"
+ "-Wl,--no-undefined"
+ "-ldl"
+)
+
+eval ./configure CC=\"${x86_cc} ${includes[@]}\" \
+ CPP=\"${x86_cc} ${includes[@]} -E\" \
+ CXX=\"${x86_cpp} ${includes[@]}\" \
+ CXXCPP=\"${x86_cpp} ${includes[@]} -E\" \
+ LDFLAGS=\"${ldflags[@]}\" \
+ --host=x86-android-linux \
+ --disable-valgrind \
+ --with-jemalloc_prefix=je_ \
+
diff --git a/android/scripts/conf_x86_64.sh b/android/scripts/conf_x86_64.sh
new file mode 100755
index 0000000..8755bfa
--- /dev/null
+++ b/android/scripts/conf_x86_64.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+if [[ "$OUT" == "" ]]; then
+ echo "In order for this script to function, please choose an x86_64 target"
+ echo "using source build/envsetup.sh and lunch XXX\n"
+ exit 1
+fi
+
+x86_64_cc="${ANDROID_TOOLCHAIN}/x86_64-linux-android-gcc"
+x86_64_cpp="${ANDROID_TOOLCHAIN}/x86_64-linux-android-g++"
+
+includes=(
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/arch-x86_64/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libstdc++/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi/asm-x86"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/android/uapi"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include"
+ "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include/amd64"
+)
+
+# Copy libm.so to libpthread.so to allow -lpthread to work.
+cp ${OUT}/obj/lib/libm.so ${OUT}/obj/lib/libpthread.so
+
+ldflags=(
+ "-nostdlib"
+ "-Bdynamic"
+ "-fPIE"
+ "-pie"
+ "-Wl,-dynamic-linker,/system/bin/linker64"
+ "-Wl,--gc-sections"
+ "-Wl,-z,nocopyreloc"
+ "-L${OUT}/obj/lib"
+ "-Wl,-rpath-link=${OUT}/obj/lib"
+ "${OUT}/obj/lib/crtbegin_dynamic.o"
+ "-Wl,--whole-archive"
+ "-Wl,--no-whole-archive"
+ "-lc"
+ "-lstdc++"
+ "-lgcc"
+ "-lm"
+ "-Wl,-z,noexecstack"
+ "-Wl,-z,relro"
+ "-Wl,-z,now"
+ "-Wl,--warn-shared-textrel"
+ "-Wl,--fatal-warnings"
+ "-Wl,--icf=safe"
+ "-Wl,--no-undefined"
+ "-ldl"
+)
+
+eval ./configure CC=\"${x86_64_cc} ${includes[@]}\" \
+ CPP=\"${x86_64_cc} ${includes[@]} -E\" \
+ CXX=\"${x86_64_cpp} ${includes[@]}\" \
+ CXXCPP=\"${x86_64_cpp} ${includes[@]} -E\" \
+ LDFLAGS=\"${ldflags[@]}\" \
+ --host=x86_64-android-linux \
+ --disable-valgrind \
+ --with-jemalloc_prefix=je_ \
+
diff --git a/android/test/run_jemalloc_tests.sh b/android/test/run_jemalloc_tests.sh
new file mode 100755
index 0000000..79a8776
--- /dev/null
+++ b/android/test/run_jemalloc_tests.sh
@@ -0,0 +1,121 @@
+#!/system/bin/sh
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+UNIT_TEST_DIR="jemalloc_unittests"
+
+UNIT_TESTS=( \
+ "a0" \
+ "arena_reset" \
+ "atomic" \
+ "bitmap" \
+ "ckh" \
+ "decay" \
+ "fork" \
+ "hash" \
+ "junk" \
+ "junk_alloc" \
+ "junk_free" \
+ "lg_chunk" \
+ "mallctl" \
+ "math" \
+ "mq" \
+ "mtx" \
+ "nstime" \
+ "pack" \
+ "pages" \
+ "prng" \
+ "prof_accum" \
+ "prof_active" \
+ "prof_gdump" \
+ "prof_idump" \
+ "prof_reset" \
+ "prof_thread_name" \
+ "ql" \
+ "qr" \
+ "quarantine" \
+ "rb" \
+ "rtree" \
+ "run_quantize" \
+ "SFMT" \
+ "size_classes" \
+ "smoothstep" \
+ "stats" \
+ "ticker" \
+ "tsd" \
+ "util" \
+ "witness" \
+ "zero" \
+)
+
+INTEGRATION_TEST_DIR="jemalloc_integrationtests"
+
+INTEGRATION_TESTS=( \
+ "aligned_alloc" \
+ "allocated" \
+ "chunk" \
+ "MALLOCX_ARENA" \
+ "mallocx" \
+ "overflow" \
+ "posix_memalign" \
+ "rallocx" \
+ "sdallocx" \
+ "thread_arena" \
+ "thread_tcache_enabled" \
+ "xallocx" \
+)
+
+TEST_DIRECTORIES=( "/data/nativetest" "/data/nativetest64" )
+FAILING_TESTS=()
+
+function run_tests () {
+ local test_type=$1
+ shift
+ local test_dir=$1
+ shift
+ local test_list=$*
+ if [[ -d "${test_dir}" ]]; then
+ for test in ${test_list[@]}; do
+ echo "Running ${test_type} ${test}"
+ ${test_dir}/$test
+ local exit_val=$?
+ # 0 means all tests passed.
+ # 1 means all tests passed but some tests were skipped.
+ # 2 means at least one failure.
+ if [[ ${exit_val} -ne 0 ]] && [[ ${exit_val} -ne 1 ]]; then
+ echo "*** $test failed: ${exit_val}"
+ FAILING_TESTS+=("${test}")
+ EXIT_CODE=$((EXIT_CODE+1))
+ fi
+ done
+ fi
+}
+
+EXIT_CODE=0
+for test_dir in ${TEST_DIRECTORIES[@]}; do
+ if [[ -d "${test_dir}" ]]; then
+ run_tests "unit" "${test_dir}/${UNIT_TEST_DIR}" ${UNIT_TESTS[@]}
+ run_tests "integration" "${test_dir}/${INTEGRATION_TEST_DIR}" ${INTEGRATION_TESTS[@]}
+ fi
+done
+if [[ ${EXIT_CODE} -eq 0 ]]; then
+ echo "All tests passed"
+else
+ echo "List of failing tests:"
+ for fail in ${FAILING_TESTS[@]}; do
+ echo " $fail"
+ done
+fi
+exit ${EXIT_CODE}
diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h
index ce4e602..1ab91ea 100644
--- a/include/jemalloc/internal/arena.h
+++ b/include/jemalloc/internal/arena.h
@@ -29,9 +29,15 @@
purge_mode_limit = 2
} purge_mode_t;
-#define PURGE_DEFAULT purge_mode_ratio
+/* ANDROID change */
+/* Use the decay mode purge method. Do not set this value to zero, since
+ * forcing a purge immediately affects performance negatively. Using a
+ * small value provides a compromise between performance and extra PSS.
+ */
+#define PURGE_DEFAULT purge_mode_decay
/* Default decay time in seconds. */
-#define DECAY_TIME_DEFAULT 10
+#define DECAY_TIME_DEFAULT 1
+/* End ANDROID change */
/* Number of event ticks between time checks. */
#define DECAY_NTICKS_PER_UPDATE 1000
@@ -1430,8 +1436,20 @@
chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
if (likely(chunk != ptr)) {
pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
+#if defined(__ANDROID__)
+ /* Verify the ptr is actually in the chunk. */
+ if (unlikely(pageind < map_bias || pageind >= chunk_npages)) {
+ __libc_fatal("Invalid address %p passed to free: invalid page index", ptr);
+ }
+#endif
mapbits = arena_mapbits_get(chunk, pageind);
assert(arena_mapbits_allocated_get(chunk, pageind) != 0);
+#if defined(__ANDROID__)
+ /* Verify the ptr has been allocated. */
+ if (unlikely((mapbits & CHUNK_MAP_ALLOCATED) == 0)) {
+ __libc_fatal("Invalid address %p passed to free: value not allocated", ptr);
+ }
+#endif
if (likely((mapbits & CHUNK_MAP_LARGE) == 0)) {
/* Small allocation. */
if (likely(tcache != NULL)) {
diff --git a/include/jemalloc/internal/chunk.h b/include/jemalloc/internal/chunk.h
index 50b9904..9b47f1c 100644
--- a/include/jemalloc/internal/chunk.h
+++ b/include/jemalloc/internal/chunk.h
@@ -5,7 +5,11 @@
* Size and alignment of memory chunks that are allocated by the OS's virtual
* memory system.
*/
+#ifdef ANDROID_LG_CHUNK_DEFAULT
+#define LG_CHUNK_DEFAULT ANDROID_LG_CHUNK_DEFAULT
+#else
#define LG_CHUNK_DEFAULT 21
+#endif
/* Return the chunk address for allocation address a. */
#define CHUNK_ADDR2BASE(a) \
diff --git a/include/jemalloc/internal/jemalloc_internal.h b/include/jemalloc/internal/jemalloc_internal.h
new file mode 100644
index 0000000..36e7345
--- /dev/null
+++ b/include/jemalloc/internal/jemalloc_internal.h
@@ -0,0 +1,1288 @@
+#ifndef JEMALLOC_INTERNAL_H
+#define JEMALLOC_INTERNAL_H
+
+#include "jemalloc_internal_defs.h"
+#include "jemalloc/internal/jemalloc_internal_decls.h"
+
+#ifdef JEMALLOC_UTRACE
+#include <sys/ktrace.h>
+#endif
+
+#define JEMALLOC_NO_DEMANGLE
+#ifdef JEMALLOC_JET
+# define JEMALLOC_N(n) jet_##n
+# include "jemalloc/internal/public_namespace.h"
+# define JEMALLOC_NO_RENAME
+# include "../jemalloc.h"
+# undef JEMALLOC_NO_RENAME
+#else
+# define JEMALLOC_N(n) je_##n
+# include "../jemalloc.h"
+#endif
+#include "jemalloc/internal/private_namespace.h"
+
+static const bool config_debug =
+#ifdef JEMALLOC_DEBUG
+ true
+#else
+ false
+#endif
+ ;
+static const bool have_dss =
+#ifdef JEMALLOC_DSS
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_fill =
+#ifdef JEMALLOC_FILL
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_lazy_lock =
+#ifdef JEMALLOC_LAZY_LOCK
+ true
+#else
+ false
+#endif
+ ;
+static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF;
+static const bool config_prof =
+#ifdef JEMALLOC_PROF
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_prof_libgcc =
+#ifdef JEMALLOC_PROF_LIBGCC
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_prof_libunwind =
+#ifdef JEMALLOC_PROF_LIBUNWIND
+ true
+#else
+ false
+#endif
+ ;
+static const bool maps_coalesce =
+#ifdef JEMALLOC_MAPS_COALESCE
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_munmap =
+#ifdef JEMALLOC_MUNMAP
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_stats =
+#ifdef JEMALLOC_STATS
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_tcache =
+#ifdef JEMALLOC_TCACHE
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_tls =
+#ifdef JEMALLOC_TLS
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_utrace =
+#ifdef JEMALLOC_UTRACE
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_valgrind =
+#ifdef JEMALLOC_VALGRIND
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_xmalloc =
+#ifdef JEMALLOC_XMALLOC
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_ivsalloc =
+#ifdef JEMALLOC_IVSALLOC
+ true
+#else
+ false
+#endif
+ ;
+static const bool config_cache_oblivious =
+#ifdef JEMALLOC_CACHE_OBLIVIOUS
+ true
+#else
+ false
+#endif
+ ;
+
+#ifdef JEMALLOC_C11ATOMICS
+#include <stdatomic.h>
+#endif
+
+#ifdef JEMALLOC_ATOMIC9
+#include <machine/atomic.h>
+#endif
+
+#if (defined(JEMALLOC_OSATOMIC) || defined(JEMALLOC_OSSPIN))
+#include <libkern/OSAtomic.h>
+#endif
+
+#ifdef JEMALLOC_ZONE
+#include <mach/mach_error.h>
+#include <mach/mach_init.h>
+#include <mach/vm_map.h>
+#include <malloc/malloc.h>
+#endif
+
+#include "jemalloc/internal/ph.h"
+#ifndef __PGI
+#define RB_COMPACT
+#endif
+#include "jemalloc/internal/rb.h"
+#include "jemalloc/internal/qr.h"
+#include "jemalloc/internal/ql.h"
+
+/*
+ * jemalloc can conceptually be broken into components (arena, tcache, etc.),
+ * but there are circular dependencies that cannot be broken without
+ * substantial performance degradation. In order to reduce the effect on
+ * visual code flow, read the header files in multiple passes, with one of the
+ * following cpp variables defined during each pass:
+ *
+ * JEMALLOC_H_TYPES : Preprocessor-defined constants and psuedo-opaque data
+ * types.
+ * JEMALLOC_H_STRUCTS : Data structures.
+ * JEMALLOC_H_EXTERNS : Extern data declarations and function prototypes.
+ * JEMALLOC_H_INLINES : Inline functions.
+ */
+/******************************************************************************/
+#define JEMALLOC_H_TYPES
+
+#include "jemalloc/internal/jemalloc_internal_macros.h"
+
+/* Page size index type. */
+typedef unsigned pszind_t;
+
+/* Size class index type. */
+typedef unsigned szind_t;
+
+/*
+ * Flags bits:
+ *
+ * a: arena
+ * t: tcache
+ * 0: unused
+ * z: zero
+ * n: alignment
+ *
+ * aaaaaaaa aaaatttt tttttttt 0znnnnnn
+ */
+#define MALLOCX_ARENA_MASK ((int)~0xfffff)
+#define MALLOCX_ARENA_MAX 0xffe
+#define MALLOCX_TCACHE_MASK ((int)~0xfff000ffU)
+#define MALLOCX_TCACHE_MAX 0xffd
+#define MALLOCX_LG_ALIGN_MASK ((int)0x3f)
+/* Use MALLOCX_ALIGN_GET() if alignment may not be specified in flags. */
+#define MALLOCX_ALIGN_GET_SPECIFIED(flags) \
+ (ZU(1) << (flags & MALLOCX_LG_ALIGN_MASK))
+#define MALLOCX_ALIGN_GET(flags) \
+ (MALLOCX_ALIGN_GET_SPECIFIED(flags) & (SIZE_T_MAX-1))
+#define MALLOCX_ZERO_GET(flags) \
+ ((bool)(flags & MALLOCX_ZERO))
+
+#define MALLOCX_TCACHE_GET(flags) \
+ (((unsigned)((flags & MALLOCX_TCACHE_MASK) >> 8)) - 2)
+#define MALLOCX_ARENA_GET(flags) \
+ (((unsigned)(((unsigned)flags) >> 20)) - 1)
+
+/* Smallest size class to support. */
+#define TINY_MIN (1U << LG_TINY_MIN)
+
+/*
+ * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
+ * classes).
+ */
+#ifndef LG_QUANTUM
+# if (defined(__i386__) || defined(_M_IX86))
+# define LG_QUANTUM 4
+# endif
+# ifdef __ia64__
+# define LG_QUANTUM 4
+# endif
+# ifdef __alpha__
+# define LG_QUANTUM 4
+# endif
+# if (defined(__sparc64__) || defined(__sparcv9) || defined(__sparc_v9__))
+# define LG_QUANTUM 4
+# endif
+# if (defined(__amd64__) || defined(__x86_64__) || defined(_M_X64))
+# define LG_QUANTUM 4
+# endif
+# ifdef __arm__
+# define LG_QUANTUM 3
+# endif
+# ifdef __aarch64__
+# define LG_QUANTUM 4
+# endif
+# ifdef __hppa__
+# define LG_QUANTUM 4
+# endif
+# ifdef __mips__
+# define LG_QUANTUM 3
+# endif
+# ifdef __or1k__
+# define LG_QUANTUM 3
+# endif
+# ifdef __powerpc__
+# define LG_QUANTUM 4
+# endif
+# ifdef __riscv__
+# define LG_QUANTUM 4
+# endif
+# ifdef __s390__
+# define LG_QUANTUM 4
+# endif
+# ifdef __SH4__
+# define LG_QUANTUM 4
+# endif
+# ifdef __tile__
+# define LG_QUANTUM 4
+# endif
+# ifdef __le32__
+# define LG_QUANTUM 4
+# endif
+# ifndef LG_QUANTUM
+# error "Unknown minimum alignment for architecture; specify via "
+ "--with-lg-quantum"
+# endif
+#endif
+
+#define QUANTUM ((size_t)(1U << LG_QUANTUM))
+#define QUANTUM_MASK (QUANTUM - 1)
+
+/* Return the smallest quantum multiple that is >= a. */
+#define QUANTUM_CEILING(a) \
+ (((a) + QUANTUM_MASK) & ~QUANTUM_MASK)
+
+#define LONG ((size_t)(1U << LG_SIZEOF_LONG))
+#define LONG_MASK (LONG - 1)
+
+/* Return the smallest long multiple that is >= a. */
+#define LONG_CEILING(a) \
+ (((a) + LONG_MASK) & ~LONG_MASK)
+
+#define SIZEOF_PTR (1U << LG_SIZEOF_PTR)
+#define PTR_MASK (SIZEOF_PTR - 1)
+
+/* Return the smallest (void *) multiple that is >= a. */
+#define PTR_CEILING(a) \
+ (((a) + PTR_MASK) & ~PTR_MASK)
+
+/*
+ * Maximum size of L1 cache line. This is used to avoid cache line aliasing.
+ * In addition, this controls the spacing of cacheline-spaced size classes.
+ *
+ * CACHELINE cannot be based on LG_CACHELINE because __declspec(align()) can
+ * only handle raw constants.
+ */
+#define LG_CACHELINE 6
+#define CACHELINE 64
+#define CACHELINE_MASK (CACHELINE - 1)
+
+/* Return the smallest cacheline multiple that is >= s. */
+#define CACHELINE_CEILING(s) \
+ (((s) + CACHELINE_MASK) & ~CACHELINE_MASK)
+
+/* Page size. LG_PAGE is determined by the configure script. */
+#ifdef PAGE_MASK
+# undef PAGE_MASK
+#endif
+#define PAGE ((size_t)(1U << LG_PAGE))
+#define PAGE_MASK ((size_t)(PAGE - 1))
+
+/* Return the page base address for the page containing address a. */
+#define PAGE_ADDR2BASE(a) \
+ ((void *)((uintptr_t)(a) & ~PAGE_MASK))
+
+/* Return the smallest pagesize multiple that is >= s. */
+#define PAGE_CEILING(s) \
+ (((s) + PAGE_MASK) & ~PAGE_MASK)
+
+/* Return the nearest aligned address at or below a. */
+#define ALIGNMENT_ADDR2BASE(a, alignment) \
+ ((void *)((uintptr_t)(a) & ((~(alignment)) + 1)))
+
+/* Return the offset between a and the nearest aligned address at or below a. */
+#define ALIGNMENT_ADDR2OFFSET(a, alignment) \
+ ((size_t)((uintptr_t)(a) & (alignment - 1)))
+
+/* Return the smallest alignment multiple that is >= s. */
+#define ALIGNMENT_CEILING(s, alignment) \
+ (((s) + (alignment - 1)) & ((~(alignment)) + 1))
+
+/* Declare a variable-length array. */
+#if __STDC_VERSION__ < 199901L
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# ifdef JEMALLOC_HAS_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
+
+#include "jemalloc/internal/nstime.h"
+#include "jemalloc/internal/valgrind.h"
+#include "jemalloc/internal/util.h"
+#include "jemalloc/internal/atomic.h"
+#include "jemalloc/internal/spin.h"
+#include "jemalloc/internal/prng.h"
+#include "jemalloc/internal/ticker.h"
+#include "jemalloc/internal/ckh.h"
+#include "jemalloc/internal/size_classes.h"
+#include "jemalloc/internal/smoothstep.h"
+#include "jemalloc/internal/stats.h"
+#include "jemalloc/internal/ctl.h"
+#include "jemalloc/internal/witness.h"
+#include "jemalloc/internal/mutex.h"
+#include "jemalloc/internal/tsd.h"
+#include "jemalloc/internal/mb.h"
+#include "jemalloc/internal/extent.h"
+#include "jemalloc/internal/arena.h"
+#include "jemalloc/internal/bitmap.h"
+#include "jemalloc/internal/base.h"
+#include "jemalloc/internal/rtree.h"
+#include "jemalloc/internal/pages.h"
+#include "jemalloc/internal/chunk.h"
+#include "jemalloc/internal/huge.h"
+#include "jemalloc/internal/tcache.h"
+#include "jemalloc/internal/hash.h"
+#include "jemalloc/internal/quarantine.h"
+#include "jemalloc/internal/prof.h"
+
+#undef JEMALLOC_H_TYPES
+/******************************************************************************/
+#define JEMALLOC_H_STRUCTS
+
+#include "jemalloc/internal/nstime.h"
+#include "jemalloc/internal/valgrind.h"
+#include "jemalloc/internal/util.h"
+#include "jemalloc/internal/atomic.h"
+#include "jemalloc/internal/spin.h"
+#include "jemalloc/internal/prng.h"
+#include "jemalloc/internal/ticker.h"
+#include "jemalloc/internal/ckh.h"
+#include "jemalloc/internal/size_classes.h"
+#include "jemalloc/internal/smoothstep.h"
+#include "jemalloc/internal/stats.h"
+#include "jemalloc/internal/ctl.h"
+#include "jemalloc/internal/witness.h"
+#include "jemalloc/internal/mutex.h"
+#include "jemalloc/internal/mb.h"
+#include "jemalloc/internal/bitmap.h"
+#define JEMALLOC_ARENA_STRUCTS_A
+#include "jemalloc/internal/arena.h"
+#undef JEMALLOC_ARENA_STRUCTS_A
+#include "jemalloc/internal/extent.h"
+#define JEMALLOC_ARENA_STRUCTS_B
+#include "jemalloc/internal/arena.h"
+#undef JEMALLOC_ARENA_STRUCTS_B
+#include "jemalloc/internal/base.h"
+#include "jemalloc/internal/rtree.h"
+#include "jemalloc/internal/pages.h"
+#include "jemalloc/internal/chunk.h"
+#include "jemalloc/internal/huge.h"
+#include "jemalloc/internal/tcache.h"
+#include "jemalloc/internal/hash.h"
+#include "jemalloc/internal/quarantine.h"
+#include "jemalloc/internal/prof.h"
+
+#include "jemalloc/internal/tsd.h"
+
+#undef JEMALLOC_H_STRUCTS
+/******************************************************************************/
+#define JEMALLOC_H_EXTERNS
+
+extern bool opt_abort;
+extern const char *opt_junk;
+extern bool opt_junk_alloc;
+extern bool opt_junk_free;
+extern size_t opt_quarantine;
+extern bool opt_redzone;
+extern bool opt_utrace;
+extern bool opt_xmalloc;
+extern bool opt_zero;
+extern unsigned opt_narenas;
+
+extern bool in_valgrind;
+
+/* Number of CPUs. */
+extern unsigned ncpus;
+
+/* Number of arenas used for automatic multiplexing of threads and arenas. */
+extern unsigned narenas_auto;
+
+/*
+ * Arenas that are used to service external requests. Not all elements of the
+ * arenas array are necessarily used; arenas are created lazily as needed.
+ */
+extern arena_t **arenas;
+
+/*
+ * pind2sz_tab encodes the same information as could be computed by
+ * pind2sz_compute().
+ */
+extern size_t const pind2sz_tab[NPSIZES];
+/*
+ * index2size_tab encodes the same information as could be computed (at
+ * unacceptable cost in some code paths) by index2size_compute().
+ */
+extern size_t const index2size_tab[NSIZES];
+/*
+ * size2index_tab is a compact lookup table that rounds request sizes up to
+ * size classes. In order to reduce cache footprint, the table is compressed,
+ * and all accesses are via size2index().
+ */
+extern uint8_t const size2index_tab[];
+
+arena_t *a0get(void);
+void *a0malloc(size_t size);
+void a0dalloc(void *ptr);
+void *bootstrap_malloc(size_t size);
+void *bootstrap_calloc(size_t num, size_t size);
+void bootstrap_free(void *ptr);
+unsigned narenas_total_get(void);
+arena_t *arena_init(tsdn_t *tsdn, unsigned ind);
+arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind);
+arena_t *arena_choose_hard(tsd_t *tsd, bool internal);
+void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind);
+void thread_allocated_cleanup(tsd_t *tsd);
+void thread_deallocated_cleanup(tsd_t *tsd);
+void iarena_cleanup(tsd_t *tsd);
+void arena_cleanup(tsd_t *tsd);
+void arenas_tdata_cleanup(tsd_t *tsd);
+void narenas_tdata_cleanup(tsd_t *tsd);
+void arenas_tdata_bypass_cleanup(tsd_t *tsd);
+void jemalloc_prefork(void);
+void jemalloc_postfork_parent(void);
+void jemalloc_postfork_child(void);
+
+#include "jemalloc/internal/nstime.h"
+#include "jemalloc/internal/valgrind.h"
+#include "jemalloc/internal/util.h"
+#include "jemalloc/internal/atomic.h"
+#include "jemalloc/internal/spin.h"
+#include "jemalloc/internal/prng.h"
+#include "jemalloc/internal/ticker.h"
+#include "jemalloc/internal/ckh.h"
+#include "jemalloc/internal/size_classes.h"
+#include "jemalloc/internal/smoothstep.h"
+#include "jemalloc/internal/stats.h"
+#include "jemalloc/internal/ctl.h"
+#include "jemalloc/internal/witness.h"
+#include "jemalloc/internal/mutex.h"
+#include "jemalloc/internal/mb.h"
+#include "jemalloc/internal/bitmap.h"
+#include "jemalloc/internal/extent.h"
+#include "jemalloc/internal/arena.h"
+#include "jemalloc/internal/base.h"
+#include "jemalloc/internal/rtree.h"
+#include "jemalloc/internal/pages.h"
+#include "jemalloc/internal/chunk.h"
+#include "jemalloc/internal/huge.h"
+#include "jemalloc/internal/tcache.h"
+#include "jemalloc/internal/hash.h"
+#include "jemalloc/internal/quarantine.h"
+#include "jemalloc/internal/prof.h"
+#include "jemalloc/internal/tsd.h"
+
+#undef JEMALLOC_H_EXTERNS
+/******************************************************************************/
+#define JEMALLOC_H_INLINES
+
+#include "jemalloc/internal/nstime.h"
+#include "jemalloc/internal/valgrind.h"
+#include "jemalloc/internal/util.h"
+#include "jemalloc/internal/atomic.h"
+#include "jemalloc/internal/spin.h"
+#include "jemalloc/internal/prng.h"
+#include "jemalloc/internal/ticker.h"
+#include "jemalloc/internal/ckh.h"
+#include "jemalloc/internal/size_classes.h"
+#include "jemalloc/internal/smoothstep.h"
+#include "jemalloc/internal/stats.h"
+#include "jemalloc/internal/ctl.h"
+#include "jemalloc/internal/tsd.h"
+#include "jemalloc/internal/witness.h"
+#include "jemalloc/internal/mutex.h"
+#include "jemalloc/internal/mb.h"
+#include "jemalloc/internal/extent.h"
+#include "jemalloc/internal/base.h"
+#include "jemalloc/internal/rtree.h"
+#include "jemalloc/internal/pages.h"
+#include "jemalloc/internal/chunk.h"
+#include "jemalloc/internal/huge.h"
+
+#ifndef JEMALLOC_ENABLE_INLINE
+pszind_t psz2ind(size_t psz);
+size_t pind2sz_compute(pszind_t pind);
+size_t pind2sz_lookup(pszind_t pind);
+size_t pind2sz(pszind_t pind);
+size_t psz2u(size_t psz);
+szind_t size2index_compute(size_t size);
+szind_t size2index_lookup(size_t size);
+szind_t size2index(size_t size);
+size_t index2size_compute(szind_t index);
+size_t index2size_lookup(szind_t index);
+size_t index2size(szind_t index);
+size_t s2u_compute(size_t size);
+size_t s2u_lookup(size_t size);
+size_t s2u(size_t size);
+size_t sa2u(size_t size, size_t alignment);
+arena_t *arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal);
+arena_t *arena_choose(tsd_t *tsd, arena_t *arena);
+arena_t *arena_ichoose(tsd_t *tsd, arena_t *arena);
+arena_tdata_t *arena_tdata_get(tsd_t *tsd, unsigned ind,
+ bool refresh_if_missing);
+arena_t *arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing);
+ticker_t *decay_ticker_get(tsd_t *tsd, unsigned ind);
+#endif
+
+#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_))
+JEMALLOC_INLINE pszind_t
+psz2ind(size_t psz)
+{
+
+ if (unlikely(psz > HUGE_MAXCLASS))
+ return (NPSIZES);
+ {
+ pszind_t x = lg_floor((psz<<1)-1);
+ pszind_t shift = (x < LG_SIZE_CLASS_GROUP + LG_PAGE) ? 0 : x -
+ (LG_SIZE_CLASS_GROUP + LG_PAGE);
+ pszind_t grp = shift << LG_SIZE_CLASS_GROUP;
+
+ pszind_t lg_delta = (x < LG_SIZE_CLASS_GROUP + LG_PAGE + 1) ?
+ LG_PAGE : x - LG_SIZE_CLASS_GROUP - 1;
+
+ size_t delta_inverse_mask = ZI(-1) << lg_delta;
+ pszind_t mod = ((((psz-1) & delta_inverse_mask) >> lg_delta)) &
+ ((ZU(1) << LG_SIZE_CLASS_GROUP) - 1);
+
+ pszind_t ind = grp + mod;
+ return (ind);
+ }
+}
+
+JEMALLOC_INLINE size_t
+pind2sz_compute(pszind_t pind)
+{
+
+ {
+ size_t grp = pind >> LG_SIZE_CLASS_GROUP;
+ size_t mod = pind & ((ZU(1) << LG_SIZE_CLASS_GROUP) - 1);
+
+ size_t grp_size_mask = ~((!!grp)-1);
+ size_t grp_size = ((ZU(1) << (LG_PAGE +
+ (LG_SIZE_CLASS_GROUP-1))) << grp) & grp_size_mask;
+
+ size_t shift = (grp == 0) ? 1 : grp;
+ size_t lg_delta = shift + (LG_PAGE-1);
+ size_t mod_size = (mod+1) << lg_delta;
+
+ size_t sz = grp_size + mod_size;
+ return (sz);
+ }
+}
+
+JEMALLOC_INLINE size_t
+pind2sz_lookup(pszind_t pind)
+{
+ size_t ret = (size_t)pind2sz_tab[pind];
+ assert(ret == pind2sz_compute(pind));
+ return (ret);
+}
+
+JEMALLOC_INLINE size_t
+pind2sz(pszind_t pind)
+{
+
+ assert(pind < NPSIZES);
+ return (pind2sz_lookup(pind));
+}
+
+JEMALLOC_INLINE size_t
+psz2u(size_t psz)
+{
+
+ if (unlikely(psz > HUGE_MAXCLASS))
+ return (0);
+ {
+ size_t x = lg_floor((psz<<1)-1);
+ size_t lg_delta = (x < LG_SIZE_CLASS_GROUP + LG_PAGE + 1) ?
+ LG_PAGE : x - LG_SIZE_CLASS_GROUP - 1;
+ size_t delta = ZU(1) << lg_delta;
+ size_t delta_mask = delta - 1;
+ size_t usize = (psz + delta_mask) & ~delta_mask;
+ return (usize);
+ }
+}
+
+JEMALLOC_INLINE szind_t
+size2index_compute(size_t size)
+{
+
+ if (unlikely(size > HUGE_MAXCLASS))
+ return (NSIZES);
+#if (NTBINS != 0)
+ if (size <= (ZU(1) << LG_TINY_MAXCLASS)) {
+ szind_t lg_tmin = LG_TINY_MAXCLASS - NTBINS + 1;
+ szind_t lg_ceil = lg_floor(pow2_ceil_zu(size));
+ return (lg_ceil < lg_tmin ? 0 : lg_ceil - lg_tmin);
+ }
+#endif
+ {
+ szind_t x = lg_floor((size<<1)-1);
+ szind_t shift = (x < LG_SIZE_CLASS_GROUP + LG_QUANTUM) ? 0 :
+ x - (LG_SIZE_CLASS_GROUP + LG_QUANTUM);
+ szind_t grp = shift << LG_SIZE_CLASS_GROUP;
+
+ szind_t lg_delta = (x < LG_SIZE_CLASS_GROUP + LG_QUANTUM + 1)
+ ? LG_QUANTUM : x - LG_SIZE_CLASS_GROUP - 1;
+
+ size_t delta_inverse_mask = ZI(-1) << lg_delta;
+ szind_t mod = ((((size-1) & delta_inverse_mask) >> lg_delta)) &
+ ((ZU(1) << LG_SIZE_CLASS_GROUP) - 1);
+
+ szind_t index = NTBINS + grp + mod;
+ return (index);
+ }
+}
+
+JEMALLOC_ALWAYS_INLINE szind_t
+size2index_lookup(size_t size)
+{
+
+ assert(size <= LOOKUP_MAXCLASS);
+ {
+ szind_t ret = (size2index_tab[(size-1) >> LG_TINY_MIN]);
+ assert(ret == size2index_compute(size));
+ return (ret);
+ }
+}
+
+JEMALLOC_ALWAYS_INLINE szind_t
+size2index(size_t size)
+{
+
+ assert(size > 0);
+ if (likely(size <= LOOKUP_MAXCLASS))
+ return (size2index_lookup(size));
+ return (size2index_compute(size));
+}
+
+JEMALLOC_INLINE size_t
+index2size_compute(szind_t index)
+{
+
+#if (NTBINS > 0)
+ if (index < NTBINS)
+ return (ZU(1) << (LG_TINY_MAXCLASS - NTBINS + 1 + index));
+#endif
+ {
+ size_t reduced_index = index - NTBINS;
+ size_t grp = reduced_index >> LG_SIZE_CLASS_GROUP;
+ size_t mod = reduced_index & ((ZU(1) << LG_SIZE_CLASS_GROUP) -
+ 1);
+
+ size_t grp_size_mask = ~((!!grp)-1);
+ size_t grp_size = ((ZU(1) << (LG_QUANTUM +
+ (LG_SIZE_CLASS_GROUP-1))) << grp) & grp_size_mask;
+
+ size_t shift = (grp == 0) ? 1 : grp;
+ size_t lg_delta = shift + (LG_QUANTUM-1);
+ size_t mod_size = (mod+1) << lg_delta;
+
+ size_t usize = grp_size + mod_size;
+ return (usize);
+ }
+}
+
+JEMALLOC_ALWAYS_INLINE size_t
+index2size_lookup(szind_t index)
+{
+ size_t ret = (size_t)index2size_tab[index];
+ assert(ret == index2size_compute(index));
+ return (ret);
+}
+
+JEMALLOC_ALWAYS_INLINE size_t
+index2size(szind_t index)
+{
+
+ assert(index < NSIZES);
+ return (index2size_lookup(index));
+}
+
+JEMALLOC_ALWAYS_INLINE size_t
+s2u_compute(size_t size)
+{
+
+ if (unlikely(size > HUGE_MAXCLASS))
+ return (0);
+#if (NTBINS > 0)
+ if (size <= (ZU(1) << LG_TINY_MAXCLASS)) {
+ size_t lg_tmin = LG_TINY_MAXCLASS - NTBINS + 1;
+ size_t lg_ceil = lg_floor(pow2_ceil_zu(size));
+ return (lg_ceil < lg_tmin ? (ZU(1) << lg_tmin) :
+ (ZU(1) << lg_ceil));
+ }
+#endif
+ {
+ size_t x = lg_floor((size<<1)-1);
+ size_t lg_delta = (x < LG_SIZE_CLASS_GROUP + LG_QUANTUM + 1)
+ ? LG_QUANTUM : x - LG_SIZE_CLASS_GROUP - 1;
+ size_t delta = ZU(1) << lg_delta;
+ size_t delta_mask = delta - 1;
+ size_t usize = (size + delta_mask) & ~delta_mask;
+ return (usize);
+ }
+}
+
+JEMALLOC_ALWAYS_INLINE size_t
+s2u_lookup(size_t size)
+{
+ size_t ret = index2size_lookup(size2index_lookup(size));
+
+ assert(ret == s2u_compute(size));
+ return (ret);
+}
+
+/*
+ * Compute usable size that would result from allocating an object with the
+ * specified size.
+ */
+JEMALLOC_ALWAYS_INLINE size_t
+s2u(size_t size)
+{
+
+ assert(size > 0);
+ if (likely(size <= LOOKUP_MAXCLASS))
+ return (s2u_lookup(size));
+ return (s2u_compute(size));
+}
+
+/*
+ * Compute usable size that would result from allocating an object with the
+ * specified size and alignment.
+ */
+JEMALLOC_ALWAYS_INLINE size_t
+sa2u(size_t size, size_t alignment)
+{
+ size_t usize;
+
+ assert(alignment != 0 && ((alignment - 1) & alignment) == 0);
+
+ /* Try for a small size class. */
+ if (size <= SMALL_MAXCLASS && alignment < PAGE) {
+ /*
+ * Round size up to the nearest multiple of alignment.
+ *
+ * This done, we can take advantage of the fact that for each
+ * small size class, every object is aligned at the smallest
+ * power of two that is non-zero in the base two representation
+ * of the size. For example:
+ *
+ * Size | Base 2 | Minimum alignment
+ * -----+----------+------------------
+ * 96 | 1100000 | 32
+ * 144 | 10100000 | 32
+ * 192 | 11000000 | 64
+ */
+ usize = s2u(ALIGNMENT_CEILING(size, alignment));
+ if (usize < LARGE_MINCLASS)
+ return (usize);
+ }
+
+ /* Try for a large size class. */
+ if (likely(size <= large_maxclass) && likely(alignment < chunksize)) {
+ /*
+ * We can't achieve subpage alignment, so round up alignment
+ * to the minimum that can actually be supported.
+ */
+ alignment = PAGE_CEILING(alignment);
+
+ /* Make sure result is a large size class. */
+ usize = (size <= LARGE_MINCLASS) ? LARGE_MINCLASS : s2u(size);
+
+ /*
+ * Calculate the size of the over-size run that arena_palloc()
+ * would need to allocate in order to guarantee the alignment.
+ */
+ if (usize + large_pad + alignment - PAGE <= arena_maxrun)
+ return (usize);
+ }
+
+ /* Huge size class. Beware of overflow. */
+
+ if (unlikely(alignment > HUGE_MAXCLASS))
+ return (0);
+
+ /*
+ * We can't achieve subchunk alignment, so round up alignment to the
+ * minimum that can actually be supported.
+ */
+ alignment = CHUNK_CEILING(alignment);
+
+ /* Make sure result is a huge size class. */
+ if (size <= chunksize)
+ usize = chunksize;
+ else {
+ usize = s2u(size);
+ if (usize < size) {
+ /* size_t overflow. */
+ return (0);
+ }
+ }
+
+ /*
+ * Calculate the multi-chunk mapping that huge_palloc() would need in
+ * order to guarantee the alignment.
+ */
+ if (usize + alignment - PAGE < usize) {
+ /* size_t overflow. */
+ return (0);
+ }
+ return (usize);
+}
+
+/* Choose an arena based on a per-thread value. */
+JEMALLOC_INLINE arena_t *
+arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal)
+{
+ arena_t *ret;
+
+ if (arena != NULL)
+ return (arena);
+
+ ret = internal ? tsd_iarena_get(tsd) : tsd_arena_get(tsd);
+ if (unlikely(ret == NULL))
+ ret = arena_choose_hard(tsd, internal);
+
+ return (ret);
+}
+
+JEMALLOC_INLINE arena_t *
+arena_choose(tsd_t *tsd, arena_t *arena)
+{
+
+ return (arena_choose_impl(tsd, arena, false));
+}
+
+JEMALLOC_INLINE arena_t *
+arena_ichoose(tsd_t *tsd, arena_t *arena)
+{
+
+ return (arena_choose_impl(tsd, arena, true));
+}
+
+JEMALLOC_INLINE arena_tdata_t *
+arena_tdata_get(tsd_t *tsd, unsigned ind, bool refresh_if_missing)
+{
+ arena_tdata_t *tdata;
+ arena_tdata_t *arenas_tdata = tsd_arenas_tdata_get(tsd);
+
+ if (unlikely(arenas_tdata == NULL)) {
+ /* arenas_tdata hasn't been initialized yet. */
+ return (arena_tdata_get_hard(tsd, ind));
+ }
+ if (unlikely(ind >= tsd_narenas_tdata_get(tsd))) {
+ /*
+ * ind is invalid, cache is old (too small), or tdata to be
+ * initialized.
+ */
+ return (refresh_if_missing ? arena_tdata_get_hard(tsd, ind) :
+ NULL);
+ }
+
+ tdata = &arenas_tdata[ind];
+ if (likely(tdata != NULL) || !refresh_if_missing)
+ return (tdata);
+ return (arena_tdata_get_hard(tsd, ind));
+}
+
+JEMALLOC_INLINE arena_t *
+arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing)
+{
+ arena_t *ret;
+
+ assert(ind <= MALLOCX_ARENA_MAX);
+
+ ret = arenas[ind];
+ if (unlikely(ret == NULL)) {
+ ret = atomic_read_p((void *)&arenas[ind]);
+ if (init_if_missing && unlikely(ret == NULL))
+ ret = arena_init(tsdn, ind);
+ }
+ return (ret);
+}
+
+JEMALLOC_INLINE ticker_t *
+decay_ticker_get(tsd_t *tsd, unsigned ind)
+{
+ arena_tdata_t *tdata;
+
+ tdata = arena_tdata_get(tsd, ind, true);
+ if (unlikely(tdata == NULL))
+ return (NULL);
+ return (&tdata->decay_ticker);
+}
+#endif
+
+#include "jemalloc/internal/bitmap.h"
+/*
+ * Include portions of arena.h interleaved with tcache.h in order to resolve
+ * circular dependencies.
+ */
+#define JEMALLOC_ARENA_INLINE_A
+#include "jemalloc/internal/arena.h"
+#undef JEMALLOC_ARENA_INLINE_A
+#include "jemalloc/internal/tcache.h"
+#define JEMALLOC_ARENA_INLINE_B
+#include "jemalloc/internal/arena.h"
+#undef JEMALLOC_ARENA_INLINE_B
+#include "jemalloc/internal/hash.h"
+#include "jemalloc/internal/quarantine.h"
+
+#ifndef JEMALLOC_ENABLE_INLINE
+arena_t *iaalloc(const void *ptr);
+size_t isalloc(tsdn_t *tsdn, const void *ptr, bool demote);
+void *iallocztm(tsdn_t *tsdn, size_t size, szind_t ind, bool zero,
+ tcache_t *tcache, bool is_metadata, arena_t *arena, bool slow_path);
+void *ialloc(tsd_t *tsd, size_t size, szind_t ind, bool zero,
+ bool slow_path);
+void *ipallocztm(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
+ tcache_t *tcache, bool is_metadata, arena_t *arena);
+void *ipalloct(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
+ tcache_t *tcache, arena_t *arena);
+void *ipalloc(tsd_t *tsd, size_t usize, size_t alignment, bool zero);
+size_t ivsalloc(tsdn_t *tsdn, const void *ptr, bool demote);
+size_t u2rz(size_t usize);
+size_t p2rz(tsdn_t *tsdn, const void *ptr);
+void idalloctm(tsdn_t *tsdn, void *ptr, tcache_t *tcache, bool is_metadata,
+ bool slow_path);
+void idalloc(tsd_t *tsd, void *ptr);
+void iqalloc(tsd_t *tsd, void *ptr, tcache_t *tcache, bool slow_path);
+void isdalloct(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
+ bool slow_path);
+void isqalloc(tsd_t *tsd, void *ptr, size_t size, tcache_t *tcache,
+ bool slow_path);
+void *iralloct_realign(tsd_t *tsd, void *ptr, size_t oldsize, size_t size,
+ size_t extra, size_t alignment, bool zero, tcache_t *tcache,
+ arena_t *arena);
+void *iralloct(tsd_t *tsd, void *ptr, size_t oldsize, size_t size,
+ size_t alignment, bool zero, tcache_t *tcache, arena_t *arena);
+void *iralloc(tsd_t *tsd, void *ptr, size_t oldsize, size_t size,
+ size_t alignment, bool zero);
+bool ixalloc(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size,
+ size_t extra, size_t alignment, bool zero);
+#endif
+
+#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_))
+JEMALLOC_ALWAYS_INLINE arena_t *
+iaalloc(const void *ptr)
+{
+
+ assert(ptr != NULL);
+
+ return (arena_aalloc(ptr));
+}
+
+/*
+ * Typical usage:
+ * tsdn_t *tsdn = [...]
+ * void *ptr = [...]
+ * size_t sz = isalloc(tsdn, ptr, config_prof);
+ */
+JEMALLOC_ALWAYS_INLINE size_t
+isalloc(tsdn_t *tsdn, const void *ptr, bool demote)
+{
+
+ assert(ptr != NULL);
+ /* Demotion only makes sense if config_prof is true. */
+ assert(config_prof || !demote);
+
+ return (arena_salloc(tsdn, ptr, demote));
+}
+
+JEMALLOC_ALWAYS_INLINE void *
+iallocztm(tsdn_t *tsdn, size_t size, szind_t ind, bool zero, tcache_t *tcache,
+ bool is_metadata, arena_t *arena, bool slow_path)
+{
+ void *ret;
+
+ assert(size != 0);
+ assert(!is_metadata || tcache == NULL);
+ assert(!is_metadata || arena == NULL || arena->ind < narenas_auto);
+
+ ret = arena_malloc(tsdn, arena, size, ind, zero, tcache, slow_path);
+ if (config_stats && is_metadata && likely(ret != NULL)) {
+ arena_metadata_allocated_add(iaalloc(ret),
+ isalloc(tsdn, ret, config_prof));
+ }
+ return (ret);
+}
+
+JEMALLOC_ALWAYS_INLINE void *
+ialloc(tsd_t *tsd, size_t size, szind_t ind, bool zero, bool slow_path)
+{
+
+ return (iallocztm(tsd_tsdn(tsd), size, ind, zero, tcache_get(tsd, true),
+ false, NULL, slow_path));
+}
+
+JEMALLOC_ALWAYS_INLINE void *
+ipallocztm(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
+ tcache_t *tcache, bool is_metadata, arena_t *arena)
+{
+ void *ret;
+
+ assert(usize != 0);
+ assert(usize == sa2u(usize, alignment));
+ assert(!is_metadata || tcache == NULL);
+ assert(!is_metadata || arena == NULL || arena->ind < narenas_auto);
+
+ ret = arena_palloc(tsdn, arena, usize, alignment, zero, tcache);
+ assert(ALIGNMENT_ADDR2BASE(ret, alignment) == ret);
+ if (config_stats && is_metadata && likely(ret != NULL)) {
+ arena_metadata_allocated_add(iaalloc(ret), isalloc(tsdn, ret,
+ config_prof));
+ }
+ return (ret);
+}
+
+JEMALLOC_ALWAYS_INLINE void *
+ipalloct(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
+ tcache_t *tcache, arena_t *arena)
+{
+
+ return (ipallocztm(tsdn, usize, alignment, zero, tcache, false, arena));
+}
+
+JEMALLOC_ALWAYS_INLINE void *
+ipalloc(tsd_t *tsd, size_t usize, size_t alignment, bool zero)
+{
+
+ return (ipallocztm(tsd_tsdn(tsd), usize, alignment, zero,
+ tcache_get(tsd, true), false, NULL));
+}
+
+JEMALLOC_ALWAYS_INLINE size_t
+ivsalloc(tsdn_t *tsdn, const void *ptr, bool demote)
+{
+ extent_node_t *node;
+
+ /* Return 0 if ptr is not within a chunk managed by jemalloc. */
+ node = chunk_lookup(ptr, false);
+ if (node == NULL)
+ return (0);
+ /* Only arena chunks should be looked up via interior pointers. */
+ assert(extent_node_addr_get(node) == ptr ||
+ extent_node_achunk_get(node));
+
+ return (isalloc(tsdn, ptr, demote));
+}
+
+JEMALLOC_INLINE size_t
+u2rz(size_t usize)
+{
+ size_t ret;
+
+ if (usize <= SMALL_MAXCLASS) {
+ szind_t binind = size2index(usize);
+ ret = arena_bin_info[binind].redzone_size;
+ } else
+ ret = 0;
+
+ return (ret);
+}
+
+JEMALLOC_INLINE size_t
+p2rz(tsdn_t *tsdn, const void *ptr)
+{
+ size_t usize = isalloc(tsdn, ptr, false);
+
+ return (u2rz(usize));
+}
+
+JEMALLOC_ALWAYS_INLINE void
+idalloctm(tsdn_t *tsdn, void *ptr, tcache_t *tcache, bool is_metadata,
+ bool slow_path)
+{
+
+ assert(ptr != NULL);
+ assert(!is_metadata || tcache == NULL);
+ assert(!is_metadata || iaalloc(ptr)->ind < narenas_auto);
+ if (config_stats && is_metadata) {
+ arena_metadata_allocated_sub(iaalloc(ptr), isalloc(tsdn, ptr,
+ config_prof));
+ }
+
+ arena_dalloc(tsdn, ptr, tcache, slow_path);
+}
+
+JEMALLOC_ALWAYS_INLINE void
+idalloc(tsd_t *tsd, void *ptr)
+{
+
+ idalloctm(tsd_tsdn(tsd), ptr, tcache_get(tsd, false), false, true);
+}
+
+JEMALLOC_ALWAYS_INLINE void
+iqalloc(tsd_t *tsd, void *ptr, tcache_t *tcache, bool slow_path)
+{
+
+ if (slow_path && config_fill && unlikely(opt_quarantine))
+ quarantine(tsd, ptr);
+ else
+ idalloctm(tsd_tsdn(tsd), ptr, tcache, false, slow_path);
+}
+
+JEMALLOC_ALWAYS_INLINE void
+isdalloct(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
+ bool slow_path)
+{
+
+ arena_sdalloc(tsdn, ptr, size, tcache, slow_path);
+}
+
+JEMALLOC_ALWAYS_INLINE void
+isqalloc(tsd_t *tsd, void *ptr, size_t size, tcache_t *tcache, bool slow_path)
+{
+
+ if (slow_path && config_fill && unlikely(opt_quarantine))
+ quarantine(tsd, ptr);
+ else
+ isdalloct(tsd_tsdn(tsd), ptr, size, tcache, slow_path);
+}
+
+JEMALLOC_ALWAYS_INLINE void *
+iralloct_realign(tsd_t *tsd, void *ptr, size_t oldsize, size_t size,
+ size_t extra, size_t alignment, bool zero, tcache_t *tcache, arena_t *arena)
+{
+ void *p;
+ size_t usize, copysize;
+
+ usize = sa2u(size + extra, alignment);
+ if (unlikely(usize == 0 || usize > HUGE_MAXCLASS))
+ return (NULL);
+ p = ipalloct(tsd_tsdn(tsd), usize, alignment, zero, tcache, arena);
+ if (p == NULL) {
+ if (extra == 0)
+ return (NULL);
+ /* Try again, without extra this time. */
+ usize = sa2u(size, alignment);
+ if (unlikely(usize == 0 || usize > HUGE_MAXCLASS))
+ return (NULL);
+ p = ipalloct(tsd_tsdn(tsd), usize, alignment, zero, tcache,
+ arena);
+ if (p == NULL)
+ return (NULL);
+ }
+ /*
+ * Copy at most size bytes (not size+extra), since the caller has no
+ * expectation that the extra bytes will be reliably preserved.
+ */
+ copysize = (size < oldsize) ? size : oldsize;
+ memcpy(p, ptr, copysize);
+ isqalloc(tsd, ptr, oldsize, tcache, true);
+ return (p);
+}
+
+JEMALLOC_ALWAYS_INLINE void *
+iralloct(tsd_t *tsd, void *ptr, size_t oldsize, size_t size, size_t alignment,
+ bool zero, tcache_t *tcache, arena_t *arena)
+{
+
+ assert(ptr != NULL);
+ assert(size != 0);
+
+ if (alignment != 0 && ((uintptr_t)ptr & ((uintptr_t)alignment-1))
+ != 0) {
+ /*
+ * Existing object alignment is inadequate; allocate new space
+ * and copy.
+ */
+ return (iralloct_realign(tsd, ptr, oldsize, size, 0, alignment,
+ zero, tcache, arena));
+ }
+
+ return (arena_ralloc(tsd, arena, ptr, oldsize, size, alignment, zero,
+ tcache));
+}
+
+JEMALLOC_ALWAYS_INLINE void *
+iralloc(tsd_t *tsd, void *ptr, size_t oldsize, size_t size, size_t alignment,
+ bool zero)
+{
+
+ return (iralloct(tsd, ptr, oldsize, size, alignment, zero,
+ tcache_get(tsd, true), NULL));
+}
+
+JEMALLOC_ALWAYS_INLINE bool
+ixalloc(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size, size_t extra,
+ size_t alignment, bool zero)
+{
+
+ assert(ptr != NULL);
+ assert(size != 0);
+
+ if (alignment != 0 && ((uintptr_t)ptr & ((uintptr_t)alignment-1))
+ != 0) {
+ /* Existing object alignment is inadequate. */
+ return (true);
+ }
+
+ return (arena_ralloc_no_move(tsdn, ptr, oldsize, size, extra, zero));
+}
+#endif
+
+#include "jemalloc/internal/prof.h"
+
+#undef JEMALLOC_H_INLINES
+/******************************************************************************/
+#endif /* JEMALLOC_INTERNAL_H */
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h b/include/jemalloc/internal/jemalloc_internal_defs.h
new file mode 100644
index 0000000..1899bf3
--- /dev/null
+++ b/include/jemalloc/internal/jemalloc_internal_defs.h
@@ -0,0 +1,325 @@
+/* include/jemalloc/internal/jemalloc_internal_defs.h. Generated from jemalloc_internal_defs.h.in by configure. */
+#ifndef JEMALLOC_INTERNAL_DEFS_H_
+#define JEMALLOC_INTERNAL_DEFS_H_
+/*
+ * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
+ * public APIs to be prefixed. This makes it possible, with some care, to use
+ * multiple allocators simultaneously.
+ */
+#define JEMALLOC_PREFIX "je_"
+#define JEMALLOC_CPREFIX "JE_"
+
+/*
+ * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
+ * For shared libraries, symbol visibility mechanisms prevent these symbols
+ * from being exported, but for static libraries, naming collisions are a real
+ * possibility.
+ */
+#define JEMALLOC_PRIVATE_NAMESPACE je_
+
+/*
+ * Hyper-threaded CPUs may need a special instruction inside spin loops in
+ * order to yield to another virtual CPU.
+ */
+#ifdef __x86_64__
+#define CPU_SPINWAIT __asm__ volatile("pause")
+#else
+#define CPU_SPINWAIT
+#endif
+
+/* Defined if C11 atomics are available. */
+#define JEMALLOC_C11ATOMICS 1
+
+/* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
+/* #undef JEMALLOC_ATOMIC9 */
+
+/*
+ * Defined if OSAtomic*() functions are available, as provided by Darwin, and
+ * documented in the atomic(3) manual page.
+ */
+/* #undef JEMALLOC_OSATOMIC */
+
+/*
+ * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
+ * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
+ * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
+ * functions are defined in libgcc instead of being inlines).
+ */
+/* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4 */
+
+/*
+ * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
+ * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
+ * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
+ * functions are defined in libgcc instead of being inlines).
+ */
+/* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8 */
+
+/*
+ * Defined if __builtin_clz() and __builtin_clzl() are available.
+ */
+#define JEMALLOC_HAVE_BUILTIN_CLZ
+
+/*
+ * Defined if os_unfair_lock_*() functions are available, as provided by Darwin.
+ */
+/* #undef JEMALLOC_OS_UNFAIR_LOCK */
+
+/*
+ * Defined if OSSpin*() functions are available, as provided by Darwin, and
+ * documented in the spinlock(3) manual page.
+ */
+/* #undef JEMALLOC_OSSPIN */
+
+/* Defined if syscall(2) is usable. */
+/* Syscalls are available in Android, but avoid them for security reasons. */
+/* #undef JEMALLOC_USE_SYSCALL */
+
+/*
+ * Defined if secure_getenv(3) is available.
+ */
+/* #undef JEMALLOC_HAVE_SECURE_GETENV */
+
+/*
+ * Defined if issetugid(2) is available.
+ */
+/* #undef JEMALLOC_HAVE_ISSETUGID */
+
+/* Defined if pthread_atfork(3) is available. */
+#define JEMALLOC_HAVE_PTHREAD_ATFORK
+
+/*
+ * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
+ */
+#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE 1
+
+/*
+ * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.
+ */
+#define JEMALLOC_HAVE_CLOCK_MONOTONIC 1
+
+/*
+ * Defined if mach_absolute_time() is available.
+ */
+/* #undef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME */
+
+/*
+ * Defined if _malloc_thread_cleanup() exists. At least in the case of
+ * FreeBSD, pthread_key_create() allocates, which if used during malloc
+ * bootstrapping will cause recursion into the pthreads library. Therefore, if
+ * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
+ * malloc_tsd.
+ */
+/* #undef JEMALLOC_MALLOC_THREAD_CLEANUP */
+
+/*
+ * Defined if threaded initialization is known to be safe on this platform.
+ * Among other things, it must be possible to initialize a mutex without
+ * triggering allocation in order for threaded allocation to be safe.
+ */
+#define JEMALLOC_THREADED_INIT
+
+/*
+ * Defined if the pthreads implementation defines
+ * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
+ * to avoid recursive allocation during mutex initialization.
+ */
+/* #undef JEMALLOC_MUTEX_INIT_CB */
+
+/* Non-empty if the tls_model attribute is supported. */
+#define JEMALLOC_TLS_MODEL
+
+/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
+#define JEMALLOC_CC_SILENCE
+
+/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
+/* #undef JEMALLOC_CODE_COVERAGE */
+
+/*
+ * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
+ * inline functions.
+ */
+/* #undef JEMALLOC_DEBUG */
+
+/* JEMALLOC_STATS enables statistics calculation. */
+#define JEMALLOC_STATS
+
+/* JEMALLOC_PROF enables allocation profiling. */
+/* #undef JEMALLOC_PROF */
+
+/* Use libunwind for profile backtracing if defined. */
+/* #undef JEMALLOC_PROF_LIBUNWIND */
+
+/* Use libgcc for profile backtracing if defined. */
+/* #undef JEMALLOC_PROF_LIBGCC */
+
+/* Use gcc intrinsics for profile backtracing if defined. */
+/* #undef JEMALLOC_PROF_GCC */
+
+/*
+ * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
+ * This makes it possible to allocate/deallocate objects without any locking
+ * when the cache is in the steady state.
+ */
+/* ANDROID: The tcache is enabled/disabled in the Makefile, not here. */
+/* #undef JEMALLOC_TCACHE */
+
+/*
+ * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
+ * segment (DSS).
+ */
+/* #undef JEMALLOC_DSS */
+
+/* Support memory filling (junk/zero/quarantine/redzone). */
+#define JEMALLOC_FILL
+
+/* Support utrace(2)-based tracing. */
+/* #undef JEMALLOC_UTRACE */
+
+/* Support Valgrind. */
+/* #undef JEMALLOC_VALGRIND */
+
+/* Support optional abort() on OOM. */
+/* #undef JEMALLOC_XMALLOC */
+
+/* Support lazy locking (avoid locking unless a second thread is launched). */
+/* #undef JEMALLOC_LAZY_LOCK */
+
+/* Minimum size class to support is 2^LG_TINY_MIN bytes. */
+#define LG_TINY_MIN 3
+
+/*
+ * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
+ * classes).
+ */
+/* #undef LG_QUANTUM */
+
+/* One page is 2^LG_PAGE bytes. */
+#define LG_PAGE 12
+
+/*
+ * If defined, adjacent virtual memory mappings with identical attributes
+ * automatically coalesce, and they fragment when changes are made to subranges.
+ * This is the normal order of things for mmap()/munmap(), but on Windows
+ * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
+ * mappings do *not* coalesce/fragment.
+ */
+#define JEMALLOC_MAPS_COALESCE
+
+/*
+ * If defined, use munmap() to unmap freed chunks, rather than storing them for
+ * later reuse. This is disabled by default on Linux because common sequences
+ * of mmap()/munmap() calls will cause virtual memory map holes.
+ */
+/* #undef JEMALLOC_MUNMAP */
+
+/* TLS is used to map arenas and magazine caches to threads. */
+/* #undef JEMALLOC_TLS */
+
+/*
+ * Used to mark unreachable code to quiet "end of non-void" compiler warnings.
+ * Don't use this directly; instead use unreachable() from util.h
+ */
+#define JEMALLOC_INTERNAL_UNREACHABLE __builtin_unreachable
+
+/*
+ * ffs*() functions to use for bitmapping. Don't use these directly; instead,
+ * use ffs_*() from util.h.
+ */
+#define JEMALLOC_INTERNAL_FFSLL __builtin_ffsll
+#define JEMALLOC_INTERNAL_FFSL __builtin_ffsl
+#define JEMALLOC_INTERNAL_FFS __builtin_ffs
+
+/*
+ * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
+ * within jemalloc-owned chunks before dereferencing them.
+ */
+/* #undef JEMALLOC_IVSALLOC */
+
+/*
+ * If defined, explicitly attempt to more uniformly distribute large allocation
+ * pointer alignments across all cache indices.
+ */
+#define JEMALLOC_CACHE_OBLIVIOUS
+
+/*
+ * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
+ */
+/* #undef JEMALLOC_ZONE */
+/* #undef JEMALLOC_ZONE_VERSION */
+
+/*
+ * Methods for determining whether the OS overcommits.
+ * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's
+ * /proc/sys/vm.overcommit_memory file.
+ * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl.
+ */
+/* #undef JEMALLOC_SYSCTL_VM_OVERCOMMIT */
+#define JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY
+
+/* Defined if madvise(2) is available. */
+#define JEMALLOC_HAVE_MADVISE
+
+/*
+ * Methods for purging unused pages differ between operating systems.
+ *
+ * madvise(..., MADV_FREE) : This marks pages as being unused, such that they
+ * will be discarded rather than swapped out.
+ * madvise(..., MADV_DONTNEED) : This immediately discards pages, such that
+ * new pages will be demand-zeroed if the
+ * address region is later touched.
+ */
+/* #undef JEMALLOC_PURGE_MADVISE_FREE */
+#define JEMALLOC_PURGE_MADVISE_DONTNEED
+
+/*
+ * Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE
+ * arguments to madvise(2).
+ */
+/* ANDROID: Do not enable huge pages because it can increase PSS. */
+/* #undef JEMALLOC_THP */
+
+/* Define if operating system has alloca.h header. */
+#define JEMALLOC_HAS_ALLOCA_H 1
+
+/* C99 restrict keyword supported. */
+#define JEMALLOC_HAS_RESTRICT 1
+
+/* For use by hash code. */
+/* #undef JEMALLOC_BIG_ENDIAN */
+
+/* sizeof(int) == 2^LG_SIZEOF_INT. */
+#define LG_SIZEOF_INT 2
+
+/* sizeof(long) == 2^LG_SIZEOF_LONG. */
+#ifdef __LP64__
+#define LG_SIZEOF_LONG 3
+#else
+#define LG_SIZEOF_LONG 2
+#endif
+
+/* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
+#define LG_SIZEOF_LONG_LONG 3
+
+/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
+#define LG_SIZEOF_INTMAX_T 3
+
+/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
+/* #undef JEMALLOC_GLIBC_MALLOC_HOOK */
+
+/* glibc memalign hook. */
+/* #undef JEMALLOC_GLIBC_MEMALIGN_HOOK */
+
+/* Adaptive mutex support in pthreads. */
+/* #undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
+
+/*
+ * If defined, jemalloc symbols are not exported (doesn't work when
+ * JEMALLOC_PREFIX is not defined).
+ */
+#define JEMALLOC_EXPORT
+
+/* config.malloc_conf options string. */
+#define JEMALLOC_CONFIG_MALLOC_CONF ""
+
+#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
diff --git a/include/jemalloc/internal/private_namespace.h b/include/jemalloc/internal/private_namespace.h
new file mode 100644
index 0000000..6bc0e2a
--- /dev/null
+++ b/include/jemalloc/internal/private_namespace.h
@@ -0,0 +1,631 @@
+#define a0dalloc JEMALLOC_N(a0dalloc)
+#define a0get JEMALLOC_N(a0get)
+#define a0malloc JEMALLOC_N(a0malloc)
+#define arena_aalloc JEMALLOC_N(arena_aalloc)
+#define arena_alloc_junk_small JEMALLOC_N(arena_alloc_junk_small)
+#define arena_basic_stats_merge JEMALLOC_N(arena_basic_stats_merge)
+#define arena_bin_index JEMALLOC_N(arena_bin_index)
+#define arena_bin_info JEMALLOC_N(arena_bin_info)
+#define arena_bitselm_get_const JEMALLOC_N(arena_bitselm_get_const)
+#define arena_bitselm_get_mutable JEMALLOC_N(arena_bitselm_get_mutable)
+#define arena_boot JEMALLOC_N(arena_boot)
+#define arena_choose JEMALLOC_N(arena_choose)
+#define arena_choose_hard JEMALLOC_N(arena_choose_hard)
+#define arena_choose_impl JEMALLOC_N(arena_choose_impl)
+#define arena_chunk_alloc_huge JEMALLOC_N(arena_chunk_alloc_huge)
+#define arena_chunk_cache_maybe_insert JEMALLOC_N(arena_chunk_cache_maybe_insert)
+#define arena_chunk_cache_maybe_remove JEMALLOC_N(arena_chunk_cache_maybe_remove)
+#define arena_chunk_dalloc_huge JEMALLOC_N(arena_chunk_dalloc_huge)
+#define arena_chunk_ralloc_huge_expand JEMALLOC_N(arena_chunk_ralloc_huge_expand)
+#define arena_chunk_ralloc_huge_shrink JEMALLOC_N(arena_chunk_ralloc_huge_shrink)
+#define arena_chunk_ralloc_huge_similar JEMALLOC_N(arena_chunk_ralloc_huge_similar)
+#define arena_cleanup JEMALLOC_N(arena_cleanup)
+#define arena_dalloc JEMALLOC_N(arena_dalloc)
+#define arena_dalloc_bin JEMALLOC_N(arena_dalloc_bin)
+#define arena_dalloc_bin_junked_locked JEMALLOC_N(arena_dalloc_bin_junked_locked)
+#define arena_dalloc_junk_large JEMALLOC_N(arena_dalloc_junk_large)
+#define arena_dalloc_junk_small JEMALLOC_N(arena_dalloc_junk_small)
+#define arena_dalloc_large JEMALLOC_N(arena_dalloc_large)
+#define arena_dalloc_large_junked_locked JEMALLOC_N(arena_dalloc_large_junked_locked)
+#define arena_dalloc_small JEMALLOC_N(arena_dalloc_small)
+#define arena_decay_tick JEMALLOC_N(arena_decay_tick)
+#define arena_decay_ticks JEMALLOC_N(arena_decay_ticks)
+#define arena_decay_time_default_get JEMALLOC_N(arena_decay_time_default_get)
+#define arena_decay_time_default_set JEMALLOC_N(arena_decay_time_default_set)
+#define arena_decay_time_get JEMALLOC_N(arena_decay_time_get)
+#define arena_decay_time_set JEMALLOC_N(arena_decay_time_set)
+#define arena_dss_prec_get JEMALLOC_N(arena_dss_prec_get)
+#define arena_dss_prec_set JEMALLOC_N(arena_dss_prec_set)
+#define arena_extent_sn_next JEMALLOC_N(arena_extent_sn_next)
+#define arena_get JEMALLOC_N(arena_get)
+#define arena_ichoose JEMALLOC_N(arena_ichoose)
+#define arena_init JEMALLOC_N(arena_init)
+#define arena_lg_dirty_mult_default_get JEMALLOC_N(arena_lg_dirty_mult_default_get)
+#define arena_lg_dirty_mult_default_set JEMALLOC_N(arena_lg_dirty_mult_default_set)
+#define arena_lg_dirty_mult_get JEMALLOC_N(arena_lg_dirty_mult_get)
+#define arena_lg_dirty_mult_set JEMALLOC_N(arena_lg_dirty_mult_set)
+#define arena_malloc JEMALLOC_N(arena_malloc)
+#define arena_malloc_hard JEMALLOC_N(arena_malloc_hard)
+#define arena_malloc_large JEMALLOC_N(arena_malloc_large)
+#define arena_mapbits_allocated_get JEMALLOC_N(arena_mapbits_allocated_get)
+#define arena_mapbits_binind_get JEMALLOC_N(arena_mapbits_binind_get)
+#define arena_mapbits_decommitted_get JEMALLOC_N(arena_mapbits_decommitted_get)
+#define arena_mapbits_dirty_get JEMALLOC_N(arena_mapbits_dirty_get)
+#define arena_mapbits_get JEMALLOC_N(arena_mapbits_get)
+#define arena_mapbits_internal_set JEMALLOC_N(arena_mapbits_internal_set)
+#define arena_mapbits_large_binind_set JEMALLOC_N(arena_mapbits_large_binind_set)
+#define arena_mapbits_large_get JEMALLOC_N(arena_mapbits_large_get)
+#define arena_mapbits_large_set JEMALLOC_N(arena_mapbits_large_set)
+#define arena_mapbits_large_size_get JEMALLOC_N(arena_mapbits_large_size_get)
+#define arena_mapbits_size_decode JEMALLOC_N(arena_mapbits_size_decode)
+#define arena_mapbits_size_encode JEMALLOC_N(arena_mapbits_size_encode)
+#define arena_mapbits_small_runind_get JEMALLOC_N(arena_mapbits_small_runind_get)
+#define arena_mapbits_small_set JEMALLOC_N(arena_mapbits_small_set)
+#define arena_mapbits_unallocated_set JEMALLOC_N(arena_mapbits_unallocated_set)
+#define arena_mapbits_unallocated_size_get JEMALLOC_N(arena_mapbits_unallocated_size_get)
+#define arena_mapbits_unallocated_size_set JEMALLOC_N(arena_mapbits_unallocated_size_set)
+#define arena_mapbits_unzeroed_get JEMALLOC_N(arena_mapbits_unzeroed_get)
+#define arena_mapbitsp_get_const JEMALLOC_N(arena_mapbitsp_get_const)
+#define arena_mapbitsp_get_mutable JEMALLOC_N(arena_mapbitsp_get_mutable)
+#define arena_mapbitsp_read JEMALLOC_N(arena_mapbitsp_read)
+#define arena_mapbitsp_write JEMALLOC_N(arena_mapbitsp_write)
+#define arena_maxrun JEMALLOC_N(arena_maxrun)
+#define arena_maybe_purge JEMALLOC_N(arena_maybe_purge)
+#define arena_metadata_allocated_add JEMALLOC_N(arena_metadata_allocated_add)
+#define arena_metadata_allocated_get JEMALLOC_N(arena_metadata_allocated_get)
+#define arena_metadata_allocated_sub JEMALLOC_N(arena_metadata_allocated_sub)
+#define arena_migrate JEMALLOC_N(arena_migrate)
+#define arena_miscelm_get_const JEMALLOC_N(arena_miscelm_get_const)
+#define arena_miscelm_get_mutable JEMALLOC_N(arena_miscelm_get_mutable)
+#define arena_miscelm_to_pageind JEMALLOC_N(arena_miscelm_to_pageind)
+#define arena_miscelm_to_rpages JEMALLOC_N(arena_miscelm_to_rpages)
+#define arena_new JEMALLOC_N(arena_new)
+#define arena_node_alloc JEMALLOC_N(arena_node_alloc)
+#define arena_node_dalloc JEMALLOC_N(arena_node_dalloc)
+#define arena_nthreads_dec JEMALLOC_N(arena_nthreads_dec)
+#define arena_nthreads_get JEMALLOC_N(arena_nthreads_get)
+#define arena_nthreads_inc JEMALLOC_N(arena_nthreads_inc)
+#define arena_palloc JEMALLOC_N(arena_palloc)
+#define arena_postfork_child JEMALLOC_N(arena_postfork_child)
+#define arena_postfork_parent JEMALLOC_N(arena_postfork_parent)
+#define arena_prefork0 JEMALLOC_N(arena_prefork0)
+#define arena_prefork1 JEMALLOC_N(arena_prefork1)
+#define arena_prefork2 JEMALLOC_N(arena_prefork2)
+#define arena_prefork3 JEMALLOC_N(arena_prefork3)
+#define arena_prof_accum JEMALLOC_N(arena_prof_accum)
+#define arena_prof_accum_impl JEMALLOC_N(arena_prof_accum_impl)
+#define arena_prof_accum_locked JEMALLOC_N(arena_prof_accum_locked)
+#define arena_prof_promoted JEMALLOC_N(arena_prof_promoted)
+#define arena_prof_tctx_get JEMALLOC_N(arena_prof_tctx_get)
+#define arena_prof_tctx_reset JEMALLOC_N(arena_prof_tctx_reset)
+#define arena_prof_tctx_set JEMALLOC_N(arena_prof_tctx_set)
+#define arena_ptr_small_binind_get JEMALLOC_N(arena_ptr_small_binind_get)
+#define arena_purge JEMALLOC_N(arena_purge)
+#define arena_quarantine_junk_small JEMALLOC_N(arena_quarantine_junk_small)
+#define arena_ralloc JEMALLOC_N(arena_ralloc)
+#define arena_ralloc_junk_large JEMALLOC_N(arena_ralloc_junk_large)
+#define arena_ralloc_no_move JEMALLOC_N(arena_ralloc_no_move)
+#define arena_rd_to_miscelm JEMALLOC_N(arena_rd_to_miscelm)
+#define arena_redzone_corruption JEMALLOC_N(arena_redzone_corruption)
+#define arena_reset JEMALLOC_N(arena_reset)
+#define arena_run_regind JEMALLOC_N(arena_run_regind)
+#define arena_run_to_miscelm JEMALLOC_N(arena_run_to_miscelm)
+#define arena_salloc JEMALLOC_N(arena_salloc)
+#define arena_sdalloc JEMALLOC_N(arena_sdalloc)
+#define arena_stats_merge JEMALLOC_N(arena_stats_merge)
+#define arena_tcache_fill_small JEMALLOC_N(arena_tcache_fill_small)
+#define arena_tdata_get JEMALLOC_N(arena_tdata_get)
+#define arena_tdata_get_hard JEMALLOC_N(arena_tdata_get_hard)
+#define arenas JEMALLOC_N(arenas)
+#define arenas_tdata_bypass_cleanup JEMALLOC_N(arenas_tdata_bypass_cleanup)
+#define arenas_tdata_cleanup JEMALLOC_N(arenas_tdata_cleanup)
+#define atomic_add_p JEMALLOC_N(atomic_add_p)
+#define atomic_add_u JEMALLOC_N(atomic_add_u)
+#define atomic_add_uint32 JEMALLOC_N(atomic_add_uint32)
+#define atomic_add_uint64 JEMALLOC_N(atomic_add_uint64)
+#define atomic_add_z JEMALLOC_N(atomic_add_z)
+#define atomic_cas_p JEMALLOC_N(atomic_cas_p)
+#define atomic_cas_u JEMALLOC_N(atomic_cas_u)
+#define atomic_cas_uint32 JEMALLOC_N(atomic_cas_uint32)
+#define atomic_cas_uint64 JEMALLOC_N(atomic_cas_uint64)
+#define atomic_cas_z JEMALLOC_N(atomic_cas_z)
+#define atomic_sub_p JEMALLOC_N(atomic_sub_p)
+#define atomic_sub_u JEMALLOC_N(atomic_sub_u)
+#define atomic_sub_uint32 JEMALLOC_N(atomic_sub_uint32)
+#define atomic_sub_uint64 JEMALLOC_N(atomic_sub_uint64)
+#define atomic_sub_z JEMALLOC_N(atomic_sub_z)
+#define atomic_write_p JEMALLOC_N(atomic_write_p)
+#define atomic_write_u JEMALLOC_N(atomic_write_u)
+#define atomic_write_uint32 JEMALLOC_N(atomic_write_uint32)
+#define atomic_write_uint64 JEMALLOC_N(atomic_write_uint64)
+#define atomic_write_z JEMALLOC_N(atomic_write_z)
+#define base_alloc JEMALLOC_N(base_alloc)
+#define base_boot JEMALLOC_N(base_boot)
+#define base_postfork_child JEMALLOC_N(base_postfork_child)
+#define base_postfork_parent JEMALLOC_N(base_postfork_parent)
+#define base_prefork JEMALLOC_N(base_prefork)
+#define base_stats_get JEMALLOC_N(base_stats_get)
+#define bitmap_full JEMALLOC_N(bitmap_full)
+#define bitmap_get JEMALLOC_N(bitmap_get)
+#define bitmap_info_init JEMALLOC_N(bitmap_info_init)
+#define bitmap_init JEMALLOC_N(bitmap_init)
+#define bitmap_set JEMALLOC_N(bitmap_set)
+#define bitmap_sfu JEMALLOC_N(bitmap_sfu)
+#define bitmap_size JEMALLOC_N(bitmap_size)
+#define bitmap_unset JEMALLOC_N(bitmap_unset)
+#define bootstrap_calloc JEMALLOC_N(bootstrap_calloc)
+#define bootstrap_free JEMALLOC_N(bootstrap_free)
+#define bootstrap_malloc JEMALLOC_N(bootstrap_malloc)
+#define bt_init JEMALLOC_N(bt_init)
+#define buferror JEMALLOC_N(buferror)
+#define chunk_alloc_base JEMALLOC_N(chunk_alloc_base)
+#define chunk_alloc_cache JEMALLOC_N(chunk_alloc_cache)
+#define chunk_alloc_dss JEMALLOC_N(chunk_alloc_dss)
+#define chunk_alloc_mmap JEMALLOC_N(chunk_alloc_mmap)
+#define chunk_alloc_wrapper JEMALLOC_N(chunk_alloc_wrapper)
+#define chunk_boot JEMALLOC_N(chunk_boot)
+#define chunk_dalloc_cache JEMALLOC_N(chunk_dalloc_cache)
+#define chunk_dalloc_mmap JEMALLOC_N(chunk_dalloc_mmap)
+#define chunk_dalloc_wrapper JEMALLOC_N(chunk_dalloc_wrapper)
+#define chunk_deregister JEMALLOC_N(chunk_deregister)
+#define chunk_dss_boot JEMALLOC_N(chunk_dss_boot)
+#define chunk_dss_mergeable JEMALLOC_N(chunk_dss_mergeable)
+#define chunk_dss_prec_get JEMALLOC_N(chunk_dss_prec_get)
+#define chunk_dss_prec_set JEMALLOC_N(chunk_dss_prec_set)
+#define chunk_hooks_default JEMALLOC_N(chunk_hooks_default)
+#define chunk_hooks_get JEMALLOC_N(chunk_hooks_get)
+#define chunk_hooks_set JEMALLOC_N(chunk_hooks_set)
+#define chunk_in_dss JEMALLOC_N(chunk_in_dss)
+#define chunk_lookup JEMALLOC_N(chunk_lookup)
+#define chunk_npages JEMALLOC_N(chunk_npages)
+#define chunk_purge_wrapper JEMALLOC_N(chunk_purge_wrapper)
+#define chunk_register JEMALLOC_N(chunk_register)
+#define chunks_rtree JEMALLOC_N(chunks_rtree)
+#define chunksize JEMALLOC_N(chunksize)
+#define chunksize_mask JEMALLOC_N(chunksize_mask)
+#define ckh_count JEMALLOC_N(ckh_count)
+#define ckh_delete JEMALLOC_N(ckh_delete)
+#define ckh_insert JEMALLOC_N(ckh_insert)
+#define ckh_iter JEMALLOC_N(ckh_iter)
+#define ckh_new JEMALLOC_N(ckh_new)
+#define ckh_pointer_hash JEMALLOC_N(ckh_pointer_hash)
+#define ckh_pointer_keycomp JEMALLOC_N(ckh_pointer_keycomp)
+#define ckh_remove JEMALLOC_N(ckh_remove)
+#define ckh_search JEMALLOC_N(ckh_search)
+#define ckh_string_hash JEMALLOC_N(ckh_string_hash)
+#define ckh_string_keycomp JEMALLOC_N(ckh_string_keycomp)
+#define ctl_boot JEMALLOC_N(ctl_boot)
+#define ctl_bymib JEMALLOC_N(ctl_bymib)
+#define ctl_byname JEMALLOC_N(ctl_byname)
+#define ctl_nametomib JEMALLOC_N(ctl_nametomib)
+#define ctl_postfork_child JEMALLOC_N(ctl_postfork_child)
+#define ctl_postfork_parent JEMALLOC_N(ctl_postfork_parent)
+#define ctl_prefork JEMALLOC_N(ctl_prefork)
+#define decay_ticker_get JEMALLOC_N(decay_ticker_get)
+#define dss_prec_names JEMALLOC_N(dss_prec_names)
+#define extent_node_achunk_get JEMALLOC_N(extent_node_achunk_get)
+#define extent_node_achunk_set JEMALLOC_N(extent_node_achunk_set)
+#define extent_node_addr_get JEMALLOC_N(extent_node_addr_get)
+#define extent_node_addr_set JEMALLOC_N(extent_node_addr_set)
+#define extent_node_arena_get JEMALLOC_N(extent_node_arena_get)
+#define extent_node_arena_set JEMALLOC_N(extent_node_arena_set)
+#define extent_node_committed_get JEMALLOC_N(extent_node_committed_get)
+#define extent_node_committed_set JEMALLOC_N(extent_node_committed_set)
+#define extent_node_dirty_insert JEMALLOC_N(extent_node_dirty_insert)
+#define extent_node_dirty_linkage_init JEMALLOC_N(extent_node_dirty_linkage_init)
+#define extent_node_dirty_remove JEMALLOC_N(extent_node_dirty_remove)
+#define extent_node_init JEMALLOC_N(extent_node_init)
+#define extent_node_prof_tctx_get JEMALLOC_N(extent_node_prof_tctx_get)
+#define extent_node_prof_tctx_set JEMALLOC_N(extent_node_prof_tctx_set)
+#define extent_node_size_get JEMALLOC_N(extent_node_size_get)
+#define extent_node_size_set JEMALLOC_N(extent_node_size_set)
+#define extent_node_sn_get JEMALLOC_N(extent_node_sn_get)
+#define extent_node_sn_set JEMALLOC_N(extent_node_sn_set)
+#define extent_node_zeroed_get JEMALLOC_N(extent_node_zeroed_get)
+#define extent_node_zeroed_set JEMALLOC_N(extent_node_zeroed_set)
+#define extent_tree_ad_destroy JEMALLOC_N(extent_tree_ad_destroy)
+#define extent_tree_ad_destroy_recurse JEMALLOC_N(extent_tree_ad_destroy_recurse)
+#define extent_tree_ad_empty JEMALLOC_N(extent_tree_ad_empty)
+#define extent_tree_ad_first JEMALLOC_N(extent_tree_ad_first)
+#define extent_tree_ad_insert JEMALLOC_N(extent_tree_ad_insert)
+#define extent_tree_ad_iter JEMALLOC_N(extent_tree_ad_iter)
+#define extent_tree_ad_iter_recurse JEMALLOC_N(extent_tree_ad_iter_recurse)
+#define extent_tree_ad_iter_start JEMALLOC_N(extent_tree_ad_iter_start)
+#define extent_tree_ad_last JEMALLOC_N(extent_tree_ad_last)
+#define extent_tree_ad_new JEMALLOC_N(extent_tree_ad_new)
+#define extent_tree_ad_next JEMALLOC_N(extent_tree_ad_next)
+#define extent_tree_ad_nsearch JEMALLOC_N(extent_tree_ad_nsearch)
+#define extent_tree_ad_prev JEMALLOC_N(extent_tree_ad_prev)
+#define extent_tree_ad_psearch JEMALLOC_N(extent_tree_ad_psearch)
+#define extent_tree_ad_remove JEMALLOC_N(extent_tree_ad_remove)
+#define extent_tree_ad_reverse_iter JEMALLOC_N(extent_tree_ad_reverse_iter)
+#define extent_tree_ad_reverse_iter_recurse JEMALLOC_N(extent_tree_ad_reverse_iter_recurse)
+#define extent_tree_ad_reverse_iter_start JEMALLOC_N(extent_tree_ad_reverse_iter_start)
+#define extent_tree_ad_search JEMALLOC_N(extent_tree_ad_search)
+#define extent_tree_szsnad_destroy JEMALLOC_N(extent_tree_szsnad_destroy)
+#define extent_tree_szsnad_destroy_recurse JEMALLOC_N(extent_tree_szsnad_destroy_recurse)
+#define extent_tree_szsnad_empty JEMALLOC_N(extent_tree_szsnad_empty)
+#define extent_tree_szsnad_first JEMALLOC_N(extent_tree_szsnad_first)
+#define extent_tree_szsnad_insert JEMALLOC_N(extent_tree_szsnad_insert)
+#define extent_tree_szsnad_iter JEMALLOC_N(extent_tree_szsnad_iter)
+#define extent_tree_szsnad_iter_recurse JEMALLOC_N(extent_tree_szsnad_iter_recurse)
+#define extent_tree_szsnad_iter_start JEMALLOC_N(extent_tree_szsnad_iter_start)
+#define extent_tree_szsnad_last JEMALLOC_N(extent_tree_szsnad_last)
+#define extent_tree_szsnad_new JEMALLOC_N(extent_tree_szsnad_new)
+#define extent_tree_szsnad_next JEMALLOC_N(extent_tree_szsnad_next)
+#define extent_tree_szsnad_nsearch JEMALLOC_N(extent_tree_szsnad_nsearch)
+#define extent_tree_szsnad_prev JEMALLOC_N(extent_tree_szsnad_prev)
+#define extent_tree_szsnad_psearch JEMALLOC_N(extent_tree_szsnad_psearch)
+#define extent_tree_szsnad_remove JEMALLOC_N(extent_tree_szsnad_remove)
+#define extent_tree_szsnad_reverse_iter JEMALLOC_N(extent_tree_szsnad_reverse_iter)
+#define extent_tree_szsnad_reverse_iter_recurse JEMALLOC_N(extent_tree_szsnad_reverse_iter_recurse)
+#define extent_tree_szsnad_reverse_iter_start JEMALLOC_N(extent_tree_szsnad_reverse_iter_start)
+#define extent_tree_szsnad_search JEMALLOC_N(extent_tree_szsnad_search)
+#define ffs_llu JEMALLOC_N(ffs_llu)
+#define ffs_lu JEMALLOC_N(ffs_lu)
+#define ffs_u JEMALLOC_N(ffs_u)
+#define ffs_u32 JEMALLOC_N(ffs_u32)
+#define ffs_u64 JEMALLOC_N(ffs_u64)
+#define ffs_zu JEMALLOC_N(ffs_zu)
+#define get_errno JEMALLOC_N(get_errno)
+#define hash JEMALLOC_N(hash)
+#define hash_fmix_32 JEMALLOC_N(hash_fmix_32)
+#define hash_fmix_64 JEMALLOC_N(hash_fmix_64)
+#define hash_get_block_32 JEMALLOC_N(hash_get_block_32)
+#define hash_get_block_64 JEMALLOC_N(hash_get_block_64)
+#define hash_rotl_32 JEMALLOC_N(hash_rotl_32)
+#define hash_rotl_64 JEMALLOC_N(hash_rotl_64)
+#define hash_x64_128 JEMALLOC_N(hash_x64_128)
+#define hash_x86_128 JEMALLOC_N(hash_x86_128)
+#define hash_x86_32 JEMALLOC_N(hash_x86_32)
+#define huge_aalloc JEMALLOC_N(huge_aalloc)
+#define huge_dalloc JEMALLOC_N(huge_dalloc)
+#define huge_dalloc_junk JEMALLOC_N(huge_dalloc_junk)
+#define huge_malloc JEMALLOC_N(huge_malloc)
+#define huge_palloc JEMALLOC_N(huge_palloc)
+#define huge_prof_tctx_get JEMALLOC_N(huge_prof_tctx_get)
+#define huge_prof_tctx_reset JEMALLOC_N(huge_prof_tctx_reset)
+#define huge_prof_tctx_set JEMALLOC_N(huge_prof_tctx_set)
+#define huge_ralloc JEMALLOC_N(huge_ralloc)
+#define huge_ralloc_no_move JEMALLOC_N(huge_ralloc_no_move)
+#define huge_salloc JEMALLOC_N(huge_salloc)
+#define iaalloc JEMALLOC_N(iaalloc)
+#define ialloc JEMALLOC_N(ialloc)
+#define iallocztm JEMALLOC_N(iallocztm)
+#define iarena_cleanup JEMALLOC_N(iarena_cleanup)
+#define idalloc JEMALLOC_N(idalloc)
+#define idalloctm JEMALLOC_N(idalloctm)
+#define in_valgrind JEMALLOC_N(in_valgrind)
+#define index2size JEMALLOC_N(index2size)
+#define index2size_compute JEMALLOC_N(index2size_compute)
+#define index2size_lookup JEMALLOC_N(index2size_lookup)
+#define index2size_tab JEMALLOC_N(index2size_tab)
+#define ipalloc JEMALLOC_N(ipalloc)
+#define ipalloct JEMALLOC_N(ipalloct)
+#define ipallocztm JEMALLOC_N(ipallocztm)
+#define iqalloc JEMALLOC_N(iqalloc)
+#define iralloc JEMALLOC_N(iralloc)
+#define iralloct JEMALLOC_N(iralloct)
+#define iralloct_realign JEMALLOC_N(iralloct_realign)
+#define isalloc JEMALLOC_N(isalloc)
+#define isdalloct JEMALLOC_N(isdalloct)
+#define isqalloc JEMALLOC_N(isqalloc)
+#define isthreaded JEMALLOC_N(isthreaded)
+#define ivsalloc JEMALLOC_N(ivsalloc)
+#define ixalloc JEMALLOC_N(ixalloc)
+#define jemalloc_postfork_child JEMALLOC_N(jemalloc_postfork_child)
+#define jemalloc_postfork_parent JEMALLOC_N(jemalloc_postfork_parent)
+#define jemalloc_prefork JEMALLOC_N(jemalloc_prefork)
+#define large_maxclass JEMALLOC_N(large_maxclass)
+#define lg_floor JEMALLOC_N(lg_floor)
+#define lg_prof_sample JEMALLOC_N(lg_prof_sample)
+#define malloc_cprintf JEMALLOC_N(malloc_cprintf)
+#define malloc_mutex_assert_not_owner JEMALLOC_N(malloc_mutex_assert_not_owner)
+#define malloc_mutex_assert_owner JEMALLOC_N(malloc_mutex_assert_owner)
+#define malloc_mutex_boot JEMALLOC_N(malloc_mutex_boot)
+#define malloc_mutex_init JEMALLOC_N(malloc_mutex_init)
+#define malloc_mutex_lock JEMALLOC_N(malloc_mutex_lock)
+#define malloc_mutex_postfork_child JEMALLOC_N(malloc_mutex_postfork_child)
+#define malloc_mutex_postfork_parent JEMALLOC_N(malloc_mutex_postfork_parent)
+#define malloc_mutex_prefork JEMALLOC_N(malloc_mutex_prefork)
+#define malloc_mutex_unlock JEMALLOC_N(malloc_mutex_unlock)
+#define malloc_printf JEMALLOC_N(malloc_printf)
+#define malloc_snprintf JEMALLOC_N(malloc_snprintf)
+#define malloc_strtoumax JEMALLOC_N(malloc_strtoumax)
+#define malloc_tsd_boot0 JEMALLOC_N(malloc_tsd_boot0)
+#define malloc_tsd_boot1 JEMALLOC_N(malloc_tsd_boot1)
+#define malloc_tsd_cleanup_register JEMALLOC_N(malloc_tsd_cleanup_register)
+#define malloc_tsd_dalloc JEMALLOC_N(malloc_tsd_dalloc)
+#define malloc_tsd_malloc JEMALLOC_N(malloc_tsd_malloc)
+#define malloc_tsd_no_cleanup JEMALLOC_N(malloc_tsd_no_cleanup)
+#define malloc_vcprintf JEMALLOC_N(malloc_vcprintf)
+#define malloc_vsnprintf JEMALLOC_N(malloc_vsnprintf)
+#define malloc_write JEMALLOC_N(malloc_write)
+#define map_bias JEMALLOC_N(map_bias)
+#define map_misc_offset JEMALLOC_N(map_misc_offset)
+#define mb_write JEMALLOC_N(mb_write)
+#define narenas_auto JEMALLOC_N(narenas_auto)
+#define narenas_tdata_cleanup JEMALLOC_N(narenas_tdata_cleanup)
+#define narenas_total_get JEMALLOC_N(narenas_total_get)
+#define ncpus JEMALLOC_N(ncpus)
+#define nhbins JEMALLOC_N(nhbins)
+#define nhclasses JEMALLOC_N(nhclasses)
+#define nlclasses JEMALLOC_N(nlclasses)
+#define nstime_add JEMALLOC_N(nstime_add)
+#define nstime_compare JEMALLOC_N(nstime_compare)
+#define nstime_copy JEMALLOC_N(nstime_copy)
+#define nstime_divide JEMALLOC_N(nstime_divide)
+#define nstime_idivide JEMALLOC_N(nstime_idivide)
+#define nstime_imultiply JEMALLOC_N(nstime_imultiply)
+#define nstime_init JEMALLOC_N(nstime_init)
+#define nstime_init2 JEMALLOC_N(nstime_init2)
+#define nstime_monotonic JEMALLOC_N(nstime_monotonic)
+#define nstime_ns JEMALLOC_N(nstime_ns)
+#define nstime_nsec JEMALLOC_N(nstime_nsec)
+#define nstime_sec JEMALLOC_N(nstime_sec)
+#define nstime_subtract JEMALLOC_N(nstime_subtract)
+#define nstime_update JEMALLOC_N(nstime_update)
+#define opt_abort JEMALLOC_N(opt_abort)
+#define opt_decay_time JEMALLOC_N(opt_decay_time)
+#define opt_dss JEMALLOC_N(opt_dss)
+#define opt_junk JEMALLOC_N(opt_junk)
+#define opt_junk_alloc JEMALLOC_N(opt_junk_alloc)
+#define opt_junk_free JEMALLOC_N(opt_junk_free)
+#define opt_lg_chunk JEMALLOC_N(opt_lg_chunk)
+#define opt_lg_dirty_mult JEMALLOC_N(opt_lg_dirty_mult)
+#define opt_lg_prof_interval JEMALLOC_N(opt_lg_prof_interval)
+#define opt_lg_prof_sample JEMALLOC_N(opt_lg_prof_sample)
+#define opt_lg_tcache_max JEMALLOC_N(opt_lg_tcache_max)
+#define opt_narenas JEMALLOC_N(opt_narenas)
+#define opt_prof JEMALLOC_N(opt_prof)
+#define opt_prof_accum JEMALLOC_N(opt_prof_accum)
+#define opt_prof_active JEMALLOC_N(opt_prof_active)
+#define opt_prof_final JEMALLOC_N(opt_prof_final)
+#define opt_prof_gdump JEMALLOC_N(opt_prof_gdump)
+#define opt_prof_leak JEMALLOC_N(opt_prof_leak)
+#define opt_prof_prefix JEMALLOC_N(opt_prof_prefix)
+#define opt_prof_thread_active_init JEMALLOC_N(opt_prof_thread_active_init)
+#define opt_purge JEMALLOC_N(opt_purge)
+#define opt_quarantine JEMALLOC_N(opt_quarantine)
+#define opt_redzone JEMALLOC_N(opt_redzone)
+#define opt_stats_print JEMALLOC_N(opt_stats_print)
+#define opt_tcache JEMALLOC_N(opt_tcache)
+#define opt_utrace JEMALLOC_N(opt_utrace)
+#define opt_xmalloc JEMALLOC_N(opt_xmalloc)
+#define opt_zero JEMALLOC_N(opt_zero)
+#define p2rz JEMALLOC_N(p2rz)
+#define pages_boot JEMALLOC_N(pages_boot)
+#define pages_commit JEMALLOC_N(pages_commit)
+#define pages_decommit JEMALLOC_N(pages_decommit)
+#define pages_huge JEMALLOC_N(pages_huge)
+#define pages_map JEMALLOC_N(pages_map)
+#define pages_nohuge JEMALLOC_N(pages_nohuge)
+#define pages_purge JEMALLOC_N(pages_purge)
+#define pages_trim JEMALLOC_N(pages_trim)
+#define pages_unmap JEMALLOC_N(pages_unmap)
+#define pind2sz JEMALLOC_N(pind2sz)
+#define pind2sz_compute JEMALLOC_N(pind2sz_compute)
+#define pind2sz_lookup JEMALLOC_N(pind2sz_lookup)
+#define pind2sz_tab JEMALLOC_N(pind2sz_tab)
+#define pow2_ceil_u32 JEMALLOC_N(pow2_ceil_u32)
+#define pow2_ceil_u64 JEMALLOC_N(pow2_ceil_u64)
+#define pow2_ceil_zu JEMALLOC_N(pow2_ceil_zu)
+#define prng_lg_range_u32 JEMALLOC_N(prng_lg_range_u32)
+#define prng_lg_range_u64 JEMALLOC_N(prng_lg_range_u64)
+#define prng_lg_range_zu JEMALLOC_N(prng_lg_range_zu)
+#define prng_range_u32 JEMALLOC_N(prng_range_u32)
+#define prng_range_u64 JEMALLOC_N(prng_range_u64)
+#define prng_range_zu JEMALLOC_N(prng_range_zu)
+#define prng_state_next_u32 JEMALLOC_N(prng_state_next_u32)
+#define prng_state_next_u64 JEMALLOC_N(prng_state_next_u64)
+#define prng_state_next_zu JEMALLOC_N(prng_state_next_zu)
+#define prof_active JEMALLOC_N(prof_active)
+#define prof_active_get JEMALLOC_N(prof_active_get)
+#define prof_active_get_unlocked JEMALLOC_N(prof_active_get_unlocked)
+#define prof_active_set JEMALLOC_N(prof_active_set)
+#define prof_alloc_prep JEMALLOC_N(prof_alloc_prep)
+#define prof_alloc_rollback JEMALLOC_N(prof_alloc_rollback)
+#define prof_backtrace JEMALLOC_N(prof_backtrace)
+#define prof_boot0 JEMALLOC_N(prof_boot0)
+#define prof_boot1 JEMALLOC_N(prof_boot1)
+#define prof_boot2 JEMALLOC_N(prof_boot2)
+#define prof_bt_count JEMALLOC_N(prof_bt_count)
+#define prof_dump_header JEMALLOC_N(prof_dump_header)
+#define prof_dump_open JEMALLOC_N(prof_dump_open)
+#define prof_free JEMALLOC_N(prof_free)
+#define prof_free_sampled_object JEMALLOC_N(prof_free_sampled_object)
+#define prof_gdump JEMALLOC_N(prof_gdump)
+#define prof_gdump_get JEMALLOC_N(prof_gdump_get)
+#define prof_gdump_get_unlocked JEMALLOC_N(prof_gdump_get_unlocked)
+#define prof_gdump_set JEMALLOC_N(prof_gdump_set)
+#define prof_gdump_val JEMALLOC_N(prof_gdump_val)
+#define prof_idump JEMALLOC_N(prof_idump)
+#define prof_interval JEMALLOC_N(prof_interval)
+#define prof_lookup JEMALLOC_N(prof_lookup)
+#define prof_malloc JEMALLOC_N(prof_malloc)
+#define prof_malloc_sample_object JEMALLOC_N(prof_malloc_sample_object)
+#define prof_mdump JEMALLOC_N(prof_mdump)
+#define prof_postfork_child JEMALLOC_N(prof_postfork_child)
+#define prof_postfork_parent JEMALLOC_N(prof_postfork_parent)
+#define prof_prefork0 JEMALLOC_N(prof_prefork0)
+#define prof_prefork1 JEMALLOC_N(prof_prefork1)
+#define prof_realloc JEMALLOC_N(prof_realloc)
+#define prof_reset JEMALLOC_N(prof_reset)
+#define prof_sample_accum_update JEMALLOC_N(prof_sample_accum_update)
+#define prof_sample_threshold_update JEMALLOC_N(prof_sample_threshold_update)
+#define prof_tctx_get JEMALLOC_N(prof_tctx_get)
+#define prof_tctx_reset JEMALLOC_N(prof_tctx_reset)
+#define prof_tctx_set JEMALLOC_N(prof_tctx_set)
+#define prof_tdata_cleanup JEMALLOC_N(prof_tdata_cleanup)
+#define prof_tdata_count JEMALLOC_N(prof_tdata_count)
+#define prof_tdata_get JEMALLOC_N(prof_tdata_get)
+#define prof_tdata_init JEMALLOC_N(prof_tdata_init)
+#define prof_tdata_reinit JEMALLOC_N(prof_tdata_reinit)
+#define prof_thread_active_get JEMALLOC_N(prof_thread_active_get)
+#define prof_thread_active_init_get JEMALLOC_N(prof_thread_active_init_get)
+#define prof_thread_active_init_set JEMALLOC_N(prof_thread_active_init_set)
+#define prof_thread_active_set JEMALLOC_N(prof_thread_active_set)
+#define prof_thread_name_get JEMALLOC_N(prof_thread_name_get)
+#define prof_thread_name_set JEMALLOC_N(prof_thread_name_set)
+#define psz2ind JEMALLOC_N(psz2ind)
+#define psz2u JEMALLOC_N(psz2u)
+#define purge_mode_names JEMALLOC_N(purge_mode_names)
+#define quarantine JEMALLOC_N(quarantine)
+#define quarantine_alloc_hook JEMALLOC_N(quarantine_alloc_hook)
+#define quarantine_alloc_hook_work JEMALLOC_N(quarantine_alloc_hook_work)
+#define quarantine_cleanup JEMALLOC_N(quarantine_cleanup)
+#define rtree_child_read JEMALLOC_N(rtree_child_read)
+#define rtree_child_read_hard JEMALLOC_N(rtree_child_read_hard)
+#define rtree_child_tryread JEMALLOC_N(rtree_child_tryread)
+#define rtree_delete JEMALLOC_N(rtree_delete)
+#define rtree_get JEMALLOC_N(rtree_get)
+#define rtree_new JEMALLOC_N(rtree_new)
+#define rtree_node_valid JEMALLOC_N(rtree_node_valid)
+#define rtree_set JEMALLOC_N(rtree_set)
+#define rtree_start_level JEMALLOC_N(rtree_start_level)
+#define rtree_subkey JEMALLOC_N(rtree_subkey)
+#define rtree_subtree_read JEMALLOC_N(rtree_subtree_read)
+#define rtree_subtree_read_hard JEMALLOC_N(rtree_subtree_read_hard)
+#define rtree_subtree_tryread JEMALLOC_N(rtree_subtree_tryread)
+#define rtree_val_read JEMALLOC_N(rtree_val_read)
+#define rtree_val_write JEMALLOC_N(rtree_val_write)
+#define run_quantize_ceil JEMALLOC_N(run_quantize_ceil)
+#define run_quantize_floor JEMALLOC_N(run_quantize_floor)
+#define s2u JEMALLOC_N(s2u)
+#define s2u_compute JEMALLOC_N(s2u_compute)
+#define s2u_lookup JEMALLOC_N(s2u_lookup)
+#define sa2u JEMALLOC_N(sa2u)
+#define set_errno JEMALLOC_N(set_errno)
+#define size2index JEMALLOC_N(size2index)
+#define size2index_compute JEMALLOC_N(size2index_compute)
+#define size2index_lookup JEMALLOC_N(size2index_lookup)
+#define size2index_tab JEMALLOC_N(size2index_tab)
+#define spin_adaptive JEMALLOC_N(spin_adaptive)
+#define spin_init JEMALLOC_N(spin_init)
+#define stats_cactive JEMALLOC_N(stats_cactive)
+#define stats_cactive_add JEMALLOC_N(stats_cactive_add)
+#define stats_cactive_get JEMALLOC_N(stats_cactive_get)
+#define stats_cactive_sub JEMALLOC_N(stats_cactive_sub)
+#define stats_print JEMALLOC_N(stats_print)
+#define tcache_alloc_easy JEMALLOC_N(tcache_alloc_easy)
+#define tcache_alloc_large JEMALLOC_N(tcache_alloc_large)
+#define tcache_alloc_small JEMALLOC_N(tcache_alloc_small)
+#define tcache_alloc_small_hard JEMALLOC_N(tcache_alloc_small_hard)
+#define tcache_arena_reassociate JEMALLOC_N(tcache_arena_reassociate)
+#define tcache_bin_flush_large JEMALLOC_N(tcache_bin_flush_large)
+#define tcache_bin_flush_small JEMALLOC_N(tcache_bin_flush_small)
+#define tcache_bin_info JEMALLOC_N(tcache_bin_info)
+#define tcache_boot JEMALLOC_N(tcache_boot)
+#define tcache_cleanup JEMALLOC_N(tcache_cleanup)
+#define tcache_create JEMALLOC_N(tcache_create)
+#define tcache_dalloc_large JEMALLOC_N(tcache_dalloc_large)
+#define tcache_dalloc_small JEMALLOC_N(tcache_dalloc_small)
+#define tcache_enabled_cleanup JEMALLOC_N(tcache_enabled_cleanup)
+#define tcache_enabled_get JEMALLOC_N(tcache_enabled_get)
+#define tcache_enabled_set JEMALLOC_N(tcache_enabled_set)
+#define tcache_event JEMALLOC_N(tcache_event)
+#define tcache_event_hard JEMALLOC_N(tcache_event_hard)
+#define tcache_flush JEMALLOC_N(tcache_flush)
+#define tcache_get JEMALLOC_N(tcache_get)
+#define tcache_get_hard JEMALLOC_N(tcache_get_hard)
+#define tcache_maxclass JEMALLOC_N(tcache_maxclass)
+#define tcache_salloc JEMALLOC_N(tcache_salloc)
+#define tcache_stats_merge JEMALLOC_N(tcache_stats_merge)
+#define tcaches JEMALLOC_N(tcaches)
+#define tcaches_create JEMALLOC_N(tcaches_create)
+#define tcaches_destroy JEMALLOC_N(tcaches_destroy)
+#define tcaches_flush JEMALLOC_N(tcaches_flush)
+#define tcaches_get JEMALLOC_N(tcaches_get)
+#define thread_allocated_cleanup JEMALLOC_N(thread_allocated_cleanup)
+#define thread_deallocated_cleanup JEMALLOC_N(thread_deallocated_cleanup)
+#define ticker_copy JEMALLOC_N(ticker_copy)
+#define ticker_init JEMALLOC_N(ticker_init)
+#define ticker_read JEMALLOC_N(ticker_read)
+#define ticker_tick JEMALLOC_N(ticker_tick)
+#define ticker_ticks JEMALLOC_N(ticker_ticks)
+#define tsd_arena_get JEMALLOC_N(tsd_arena_get)
+#define tsd_arena_set JEMALLOC_N(tsd_arena_set)
+#define tsd_arenap_get JEMALLOC_N(tsd_arenap_get)
+#define tsd_arenas_tdata_bypass_get JEMALLOC_N(tsd_arenas_tdata_bypass_get)
+#define tsd_arenas_tdata_bypass_set JEMALLOC_N(tsd_arenas_tdata_bypass_set)
+#define tsd_arenas_tdata_bypassp_get JEMALLOC_N(tsd_arenas_tdata_bypassp_get)
+#define tsd_arenas_tdata_get JEMALLOC_N(tsd_arenas_tdata_get)
+#define tsd_arenas_tdata_set JEMALLOC_N(tsd_arenas_tdata_set)
+#define tsd_arenas_tdatap_get JEMALLOC_N(tsd_arenas_tdatap_get)
+#define tsd_boot JEMALLOC_N(tsd_boot)
+#define tsd_boot0 JEMALLOC_N(tsd_boot0)
+#define tsd_boot1 JEMALLOC_N(tsd_boot1)
+#define tsd_booted JEMALLOC_N(tsd_booted)
+#define tsd_booted_get JEMALLOC_N(tsd_booted_get)
+#define tsd_cleanup JEMALLOC_N(tsd_cleanup)
+#define tsd_cleanup_wrapper JEMALLOC_N(tsd_cleanup_wrapper)
+#define tsd_fetch JEMALLOC_N(tsd_fetch)
+#define tsd_fetch_impl JEMALLOC_N(tsd_fetch_impl)
+#define tsd_get JEMALLOC_N(tsd_get)
+#define tsd_get_allocates JEMALLOC_N(tsd_get_allocates)
+#define tsd_iarena_get JEMALLOC_N(tsd_iarena_get)
+#define tsd_iarena_set JEMALLOC_N(tsd_iarena_set)
+#define tsd_iarenap_get JEMALLOC_N(tsd_iarenap_get)
+#define tsd_initialized JEMALLOC_N(tsd_initialized)
+#define tsd_init_check_recursion JEMALLOC_N(tsd_init_check_recursion)
+#define tsd_init_finish JEMALLOC_N(tsd_init_finish)
+#define tsd_init_head JEMALLOC_N(tsd_init_head)
+#define tsd_narenas_tdata_get JEMALLOC_N(tsd_narenas_tdata_get)
+#define tsd_narenas_tdata_set JEMALLOC_N(tsd_narenas_tdata_set)
+#define tsd_narenas_tdatap_get JEMALLOC_N(tsd_narenas_tdatap_get)
+#define tsd_wrapper_get JEMALLOC_N(tsd_wrapper_get)
+#define tsd_wrapper_set JEMALLOC_N(tsd_wrapper_set)
+#define tsd_nominal JEMALLOC_N(tsd_nominal)
+#define tsd_prof_tdata_get JEMALLOC_N(tsd_prof_tdata_get)
+#define tsd_prof_tdata_set JEMALLOC_N(tsd_prof_tdata_set)
+#define tsd_prof_tdatap_get JEMALLOC_N(tsd_prof_tdatap_get)
+#define tsd_quarantine_get JEMALLOC_N(tsd_quarantine_get)
+#define tsd_quarantine_set JEMALLOC_N(tsd_quarantine_set)
+#define tsd_quarantinep_get JEMALLOC_N(tsd_quarantinep_get)
+#define tsd_set JEMALLOC_N(tsd_set)
+#define tsd_tcache_enabled_get JEMALLOC_N(tsd_tcache_enabled_get)
+#define tsd_tcache_enabled_set JEMALLOC_N(tsd_tcache_enabled_set)
+#define tsd_tcache_enabledp_get JEMALLOC_N(tsd_tcache_enabledp_get)
+#define tsd_tcache_get JEMALLOC_N(tsd_tcache_get)
+#define tsd_tcache_set JEMALLOC_N(tsd_tcache_set)
+#define tsd_tcachep_get JEMALLOC_N(tsd_tcachep_get)
+#define tsd_thread_allocated_get JEMALLOC_N(tsd_thread_allocated_get)
+#define tsd_thread_allocated_set JEMALLOC_N(tsd_thread_allocated_set)
+#define tsd_thread_allocatedp_get JEMALLOC_N(tsd_thread_allocatedp_get)
+#define tsd_thread_deallocated_get JEMALLOC_N(tsd_thread_deallocated_get)
+#define tsd_thread_deallocated_set JEMALLOC_N(tsd_thread_deallocated_set)
+#define tsd_thread_deallocatedp_get JEMALLOC_N(tsd_thread_deallocatedp_get)
+#define tsd_tls JEMALLOC_N(tsd_tls)
+#define tsd_tsd JEMALLOC_N(tsd_tsd)
+#define tsd_tsdn JEMALLOC_N(tsd_tsdn)
+#define tsd_witness_fork_get JEMALLOC_N(tsd_witness_fork_get)
+#define tsd_witness_fork_set JEMALLOC_N(tsd_witness_fork_set)
+#define tsd_witness_forkp_get JEMALLOC_N(tsd_witness_forkp_get)
+#define tsd_witnesses_get JEMALLOC_N(tsd_witnesses_get)
+#define tsd_witnesses_set JEMALLOC_N(tsd_witnesses_set)
+#define tsd_witnessesp_get JEMALLOC_N(tsd_witnessesp_get)
+#define tsdn_fetch JEMALLOC_N(tsdn_fetch)
+#define tsdn_null JEMALLOC_N(tsdn_null)
+#define tsdn_tsd JEMALLOC_N(tsdn_tsd)
+#define u2rz JEMALLOC_N(u2rz)
+#define valgrind_freelike_block JEMALLOC_N(valgrind_freelike_block)
+#define valgrind_make_mem_defined JEMALLOC_N(valgrind_make_mem_defined)
+#define valgrind_make_mem_noaccess JEMALLOC_N(valgrind_make_mem_noaccess)
+#define valgrind_make_mem_undefined JEMALLOC_N(valgrind_make_mem_undefined)
+#define witness_assert_lockless JEMALLOC_N(witness_assert_lockless)
+#define witness_assert_not_owner JEMALLOC_N(witness_assert_not_owner)
+#define witness_assert_owner JEMALLOC_N(witness_assert_owner)
+#define witness_fork_cleanup JEMALLOC_N(witness_fork_cleanup)
+#define witness_init JEMALLOC_N(witness_init)
+#define witness_lock JEMALLOC_N(witness_lock)
+#define witness_lock_error JEMALLOC_N(witness_lock_error)
+#define witness_lockless_error JEMALLOC_N(witness_lockless_error)
+#define witness_not_owner_error JEMALLOC_N(witness_not_owner_error)
+#define witness_owner JEMALLOC_N(witness_owner)
+#define witness_owner_error JEMALLOC_N(witness_owner_error)
+#define witness_postfork_child JEMALLOC_N(witness_postfork_child)
+#define witness_postfork_parent JEMALLOC_N(witness_postfork_parent)
+#define witness_prefork JEMALLOC_N(witness_prefork)
+#define witness_unlock JEMALLOC_N(witness_unlock)
+#define witnesses_cleanup JEMALLOC_N(witnesses_cleanup)
+#define zone_register JEMALLOC_N(zone_register)
diff --git a/include/jemalloc/internal/private_unnamespace.h b/include/jemalloc/internal/private_unnamespace.h
new file mode 100644
index 0000000..44530f7
--- /dev/null
+++ b/include/jemalloc/internal/private_unnamespace.h
@@ -0,0 +1,631 @@
+#undef a0dalloc
+#undef a0get
+#undef a0malloc
+#undef arena_aalloc
+#undef arena_alloc_junk_small
+#undef arena_basic_stats_merge
+#undef arena_bin_index
+#undef arena_bin_info
+#undef arena_bitselm_get_const
+#undef arena_bitselm_get_mutable
+#undef arena_boot
+#undef arena_choose
+#undef arena_choose_hard
+#undef arena_choose_impl
+#undef arena_chunk_alloc_huge
+#undef arena_chunk_cache_maybe_insert
+#undef arena_chunk_cache_maybe_remove
+#undef arena_chunk_dalloc_huge
+#undef arena_chunk_ralloc_huge_expand
+#undef arena_chunk_ralloc_huge_shrink
+#undef arena_chunk_ralloc_huge_similar
+#undef arena_cleanup
+#undef arena_dalloc
+#undef arena_dalloc_bin
+#undef arena_dalloc_bin_junked_locked
+#undef arena_dalloc_junk_large
+#undef arena_dalloc_junk_small
+#undef arena_dalloc_large
+#undef arena_dalloc_large_junked_locked
+#undef arena_dalloc_small
+#undef arena_decay_tick
+#undef arena_decay_ticks
+#undef arena_decay_time_default_get
+#undef arena_decay_time_default_set
+#undef arena_decay_time_get
+#undef arena_decay_time_set
+#undef arena_dss_prec_get
+#undef arena_dss_prec_set
+#undef arena_extent_sn_next
+#undef arena_get
+#undef arena_ichoose
+#undef arena_init
+#undef arena_lg_dirty_mult_default_get
+#undef arena_lg_dirty_mult_default_set
+#undef arena_lg_dirty_mult_get
+#undef arena_lg_dirty_mult_set
+#undef arena_malloc
+#undef arena_malloc_hard
+#undef arena_malloc_large
+#undef arena_mapbits_allocated_get
+#undef arena_mapbits_binind_get
+#undef arena_mapbits_decommitted_get
+#undef arena_mapbits_dirty_get
+#undef arena_mapbits_get
+#undef arena_mapbits_internal_set
+#undef arena_mapbits_large_binind_set
+#undef arena_mapbits_large_get
+#undef arena_mapbits_large_set
+#undef arena_mapbits_large_size_get
+#undef arena_mapbits_size_decode
+#undef arena_mapbits_size_encode
+#undef arena_mapbits_small_runind_get
+#undef arena_mapbits_small_set
+#undef arena_mapbits_unallocated_set
+#undef arena_mapbits_unallocated_size_get
+#undef arena_mapbits_unallocated_size_set
+#undef arena_mapbits_unzeroed_get
+#undef arena_mapbitsp_get_const
+#undef arena_mapbitsp_get_mutable
+#undef arena_mapbitsp_read
+#undef arena_mapbitsp_write
+#undef arena_maxrun
+#undef arena_maybe_purge
+#undef arena_metadata_allocated_add
+#undef arena_metadata_allocated_get
+#undef arena_metadata_allocated_sub
+#undef arena_migrate
+#undef arena_miscelm_get_const
+#undef arena_miscelm_get_mutable
+#undef arena_miscelm_to_pageind
+#undef arena_miscelm_to_rpages
+#undef arena_new
+#undef arena_node_alloc
+#undef arena_node_dalloc
+#undef arena_nthreads_dec
+#undef arena_nthreads_get
+#undef arena_nthreads_inc
+#undef arena_palloc
+#undef arena_postfork_child
+#undef arena_postfork_parent
+#undef arena_prefork0
+#undef arena_prefork1
+#undef arena_prefork2
+#undef arena_prefork3
+#undef arena_prof_accum
+#undef arena_prof_accum_impl
+#undef arena_prof_accum_locked
+#undef arena_prof_promoted
+#undef arena_prof_tctx_get
+#undef arena_prof_tctx_reset
+#undef arena_prof_tctx_set
+#undef arena_ptr_small_binind_get
+#undef arena_purge
+#undef arena_quarantine_junk_small
+#undef arena_ralloc
+#undef arena_ralloc_junk_large
+#undef arena_ralloc_no_move
+#undef arena_rd_to_miscelm
+#undef arena_redzone_corruption
+#undef arena_reset
+#undef arena_run_regind
+#undef arena_run_to_miscelm
+#undef arena_salloc
+#undef arena_sdalloc
+#undef arena_stats_merge
+#undef arena_tcache_fill_small
+#undef arena_tdata_get
+#undef arena_tdata_get_hard
+#undef arenas
+#undef arenas_tdata_bypass_cleanup
+#undef arenas_tdata_cleanup
+#undef atomic_add_p
+#undef atomic_add_u
+#undef atomic_add_uint32
+#undef atomic_add_uint64
+#undef atomic_add_z
+#undef atomic_cas_p
+#undef atomic_cas_u
+#undef atomic_cas_uint32
+#undef atomic_cas_uint64
+#undef atomic_cas_z
+#undef atomic_sub_p
+#undef atomic_sub_u
+#undef atomic_sub_uint32
+#undef atomic_sub_uint64
+#undef atomic_sub_z
+#undef atomic_write_p
+#undef atomic_write_u
+#undef atomic_write_uint32
+#undef atomic_write_uint64
+#undef atomic_write_z
+#undef base_alloc
+#undef base_boot
+#undef base_postfork_child
+#undef base_postfork_parent
+#undef base_prefork
+#undef base_stats_get
+#undef bitmap_full
+#undef bitmap_get
+#undef bitmap_info_init
+#undef bitmap_init
+#undef bitmap_set
+#undef bitmap_sfu
+#undef bitmap_size
+#undef bitmap_unset
+#undef bootstrap_calloc
+#undef bootstrap_free
+#undef bootstrap_malloc
+#undef bt_init
+#undef buferror
+#undef chunk_alloc_base
+#undef chunk_alloc_cache
+#undef chunk_alloc_dss
+#undef chunk_alloc_mmap
+#undef chunk_alloc_wrapper
+#undef chunk_boot
+#undef chunk_dalloc_cache
+#undef chunk_dalloc_mmap
+#undef chunk_dalloc_wrapper
+#undef chunk_deregister
+#undef chunk_dss_boot
+#undef chunk_dss_mergeable
+#undef chunk_dss_prec_get
+#undef chunk_dss_prec_set
+#undef chunk_hooks_default
+#undef chunk_hooks_get
+#undef chunk_hooks_set
+#undef chunk_in_dss
+#undef chunk_lookup
+#undef chunk_npages
+#undef chunk_purge_wrapper
+#undef chunk_register
+#undef chunks_rtree
+#undef chunksize
+#undef chunksize_mask
+#undef ckh_count
+#undef ckh_delete
+#undef ckh_insert
+#undef ckh_iter
+#undef ckh_new
+#undef ckh_pointer_hash
+#undef ckh_pointer_keycomp
+#undef ckh_remove
+#undef ckh_search
+#undef ckh_string_hash
+#undef ckh_string_keycomp
+#undef ctl_boot
+#undef ctl_bymib
+#undef ctl_byname
+#undef ctl_nametomib
+#undef ctl_postfork_child
+#undef ctl_postfork_parent
+#undef ctl_prefork
+#undef decay_ticker_get
+#undef dss_prec_names
+#undef extent_node_achunk_get
+#undef extent_node_achunk_set
+#undef extent_node_addr_get
+#undef extent_node_addr_set
+#undef extent_node_arena_get
+#undef extent_node_arena_set
+#undef extent_node_committed_get
+#undef extent_node_committed_set
+#undef extent_node_dirty_insert
+#undef extent_node_dirty_linkage_init
+#undef extent_node_dirty_remove
+#undef extent_node_init
+#undef extent_node_prof_tctx_get
+#undef extent_node_prof_tctx_set
+#undef extent_node_size_get
+#undef extent_node_size_set
+#undef extent_node_sn_get
+#undef extent_node_sn_set
+#undef extent_node_zeroed_get
+#undef extent_node_zeroed_set
+#undef extent_tree_ad_destroy
+#undef extent_tree_ad_destroy_recurse
+#undef extent_tree_ad_empty
+#undef extent_tree_ad_first
+#undef extent_tree_ad_insert
+#undef extent_tree_ad_iter
+#undef extent_tree_ad_iter_recurse
+#undef extent_tree_ad_iter_start
+#undef extent_tree_ad_last
+#undef extent_tree_ad_new
+#undef extent_tree_ad_next
+#undef extent_tree_ad_nsearch
+#undef extent_tree_ad_prev
+#undef extent_tree_ad_psearch
+#undef extent_tree_ad_remove
+#undef extent_tree_ad_reverse_iter
+#undef extent_tree_ad_reverse_iter_recurse
+#undef extent_tree_ad_reverse_iter_start
+#undef extent_tree_ad_search
+#undef extent_tree_szsnad_destroy
+#undef extent_tree_szsnad_destroy_recurse
+#undef extent_tree_szsnad_empty
+#undef extent_tree_szsnad_first
+#undef extent_tree_szsnad_insert
+#undef extent_tree_szsnad_iter
+#undef extent_tree_szsnad_iter_recurse
+#undef extent_tree_szsnad_iter_start
+#undef extent_tree_szsnad_last
+#undef extent_tree_szsnad_new
+#undef extent_tree_szsnad_next
+#undef extent_tree_szsnad_nsearch
+#undef extent_tree_szsnad_prev
+#undef extent_tree_szsnad_psearch
+#undef extent_tree_szsnad_remove
+#undef extent_tree_szsnad_reverse_iter
+#undef extent_tree_szsnad_reverse_iter_recurse
+#undef extent_tree_szsnad_reverse_iter_start
+#undef extent_tree_szsnad_search
+#undef ffs_llu
+#undef ffs_lu
+#undef ffs_u
+#undef ffs_u32
+#undef ffs_u64
+#undef ffs_zu
+#undef get_errno
+#undef hash
+#undef hash_fmix_32
+#undef hash_fmix_64
+#undef hash_get_block_32
+#undef hash_get_block_64
+#undef hash_rotl_32
+#undef hash_rotl_64
+#undef hash_x64_128
+#undef hash_x86_128
+#undef hash_x86_32
+#undef huge_aalloc
+#undef huge_dalloc
+#undef huge_dalloc_junk
+#undef huge_malloc
+#undef huge_palloc
+#undef huge_prof_tctx_get
+#undef huge_prof_tctx_reset
+#undef huge_prof_tctx_set
+#undef huge_ralloc
+#undef huge_ralloc_no_move
+#undef huge_salloc
+#undef iaalloc
+#undef ialloc
+#undef iallocztm
+#undef iarena_cleanup
+#undef idalloc
+#undef idalloctm
+#undef in_valgrind
+#undef index2size
+#undef index2size_compute
+#undef index2size_lookup
+#undef index2size_tab
+#undef ipalloc
+#undef ipalloct
+#undef ipallocztm
+#undef iqalloc
+#undef iralloc
+#undef iralloct
+#undef iralloct_realign
+#undef isalloc
+#undef isdalloct
+#undef isqalloc
+#undef isthreaded
+#undef ivsalloc
+#undef ixalloc
+#undef jemalloc_postfork_child
+#undef jemalloc_postfork_parent
+#undef jemalloc_prefork
+#undef large_maxclass
+#undef lg_floor
+#undef lg_prof_sample
+#undef malloc_cprintf
+#undef malloc_mutex_assert_not_owner
+#undef malloc_mutex_assert_owner
+#undef malloc_mutex_boot
+#undef malloc_mutex_init
+#undef malloc_mutex_lock
+#undef malloc_mutex_postfork_child
+#undef malloc_mutex_postfork_parent
+#undef malloc_mutex_prefork
+#undef malloc_mutex_unlock
+#undef malloc_printf
+#undef malloc_snprintf
+#undef malloc_strtoumax
+#undef malloc_tsd_boot0
+#undef malloc_tsd_boot1
+#undef malloc_tsd_cleanup_register
+#undef malloc_tsd_dalloc
+#undef malloc_tsd_malloc
+#undef malloc_tsd_no_cleanup
+#undef malloc_vcprintf
+#undef malloc_vsnprintf
+#undef malloc_write
+#undef map_bias
+#undef map_misc_offset
+#undef mb_write
+#undef narenas_auto
+#undef narenas_tdata_cleanup
+#undef narenas_total_get
+#undef ncpus
+#undef nhbins
+#undef nhclasses
+#undef nlclasses
+#undef nstime_add
+#undef nstime_compare
+#undef nstime_copy
+#undef nstime_divide
+#undef nstime_idivide
+#undef nstime_imultiply
+#undef nstime_init
+#undef nstime_init2
+#undef nstime_monotonic
+#undef nstime_ns
+#undef nstime_nsec
+#undef nstime_sec
+#undef nstime_subtract
+#undef nstime_update
+#undef opt_abort
+#undef opt_decay_time
+#undef opt_dss
+#undef opt_junk
+#undef opt_junk_alloc
+#undef opt_junk_free
+#undef opt_lg_chunk
+#undef opt_lg_dirty_mult
+#undef opt_lg_prof_interval
+#undef opt_lg_prof_sample
+#undef opt_lg_tcache_max
+#undef opt_narenas
+#undef opt_prof
+#undef opt_prof_accum
+#undef opt_prof_active
+#undef opt_prof_final
+#undef opt_prof_gdump
+#undef opt_prof_leak
+#undef opt_prof_prefix
+#undef opt_prof_thread_active_init
+#undef opt_purge
+#undef opt_quarantine
+#undef opt_redzone
+#undef opt_stats_print
+#undef opt_tcache
+#undef opt_utrace
+#undef opt_xmalloc
+#undef opt_zero
+#undef p2rz
+#undef pages_boot
+#undef pages_commit
+#undef pages_decommit
+#undef pages_huge
+#undef pages_map
+#undef pages_nohuge
+#undef pages_purge
+#undef pages_trim
+#undef pages_unmap
+#undef pind2sz
+#undef pind2sz_compute
+#undef pind2sz_lookup
+#undef pind2sz_tab
+#undef pow2_ceil_u32
+#undef pow2_ceil_u64
+#undef pow2_ceil_zu
+#undef prng_lg_range_u32
+#undef prng_lg_range_u64
+#undef prng_lg_range_zu
+#undef prng_range_u32
+#undef prng_range_u64
+#undef prng_range_zu
+#undef prng_state_next_u32
+#undef prng_state_next_u64
+#undef prng_state_next_zu
+#undef prof_active
+#undef prof_active_get
+#undef prof_active_get_unlocked
+#undef prof_active_set
+#undef prof_alloc_prep
+#undef prof_alloc_rollback
+#undef prof_backtrace
+#undef prof_boot0
+#undef prof_boot1
+#undef prof_boot2
+#undef prof_bt_count
+#undef prof_dump_header
+#undef prof_dump_open
+#undef prof_free
+#undef prof_free_sampled_object
+#undef prof_gdump
+#undef prof_gdump_get
+#undef prof_gdump_get_unlocked
+#undef prof_gdump_set
+#undef prof_gdump_val
+#undef prof_idump
+#undef prof_interval
+#undef prof_lookup
+#undef prof_malloc
+#undef prof_malloc_sample_object
+#undef prof_mdump
+#undef prof_postfork_child
+#undef prof_postfork_parent
+#undef prof_prefork0
+#undef prof_prefork1
+#undef prof_realloc
+#undef prof_reset
+#undef prof_sample_accum_update
+#undef prof_sample_threshold_update
+#undef prof_tctx_get
+#undef prof_tctx_reset
+#undef prof_tctx_set
+#undef prof_tdata_cleanup
+#undef prof_tdata_count
+#undef prof_tdata_get
+#undef prof_tdata_init
+#undef prof_tdata_reinit
+#undef prof_thread_active_get
+#undef prof_thread_active_init_get
+#undef prof_thread_active_init_set
+#undef prof_thread_active_set
+#undef prof_thread_name_get
+#undef prof_thread_name_set
+#undef psz2ind
+#undef psz2u
+#undef purge_mode_names
+#undef quarantine
+#undef quarantine_alloc_hook
+#undef quarantine_alloc_hook_work
+#undef quarantine_cleanup
+#undef rtree_child_read
+#undef rtree_child_read_hard
+#undef rtree_child_tryread
+#undef rtree_delete
+#undef rtree_get
+#undef rtree_new
+#undef rtree_node_valid
+#undef rtree_set
+#undef rtree_start_level
+#undef rtree_subkey
+#undef rtree_subtree_read
+#undef rtree_subtree_read_hard
+#undef rtree_subtree_tryread
+#undef rtree_val_read
+#undef rtree_val_write
+#undef run_quantize_ceil
+#undef run_quantize_floor
+#undef s2u
+#undef s2u_compute
+#undef s2u_lookup
+#undef sa2u
+#undef set_errno
+#undef size2index
+#undef size2index_compute
+#undef size2index_lookup
+#undef size2index_tab
+#undef spin_adaptive
+#undef spin_init
+#undef stats_cactive
+#undef stats_cactive_add
+#undef stats_cactive_get
+#undef stats_cactive_sub
+#undef stats_print
+#undef tcache_alloc_easy
+#undef tcache_alloc_large
+#undef tcache_alloc_small
+#undef tcache_alloc_small_hard
+#undef tcache_arena_reassociate
+#undef tcache_bin_flush_large
+#undef tcache_bin_flush_small
+#undef tcache_bin_info
+#undef tcache_boot
+#undef tcache_cleanup
+#undef tcache_create
+#undef tcache_dalloc_large
+#undef tcache_dalloc_small
+#undef tcache_enabled_cleanup
+#undef tcache_enabled_get
+#undef tcache_enabled_set
+#undef tcache_event
+#undef tcache_event_hard
+#undef tcache_flush
+#undef tcache_get
+#undef tcache_get_hard
+#undef tcache_maxclass
+#undef tcache_salloc
+#undef tcache_stats_merge
+#undef tcaches
+#undef tcaches_create
+#undef tcaches_destroy
+#undef tcaches_flush
+#undef tcaches_get
+#undef thread_allocated_cleanup
+#undef thread_deallocated_cleanup
+#undef ticker_copy
+#undef ticker_init
+#undef ticker_read
+#undef ticker_tick
+#undef ticker_ticks
+#undef tsd_arena_get
+#undef tsd_arena_set
+#undef tsd_arenap_get
+#undef tsd_arenas_tdata_bypass_get
+#undef tsd_arenas_tdata_bypass_set
+#undef tsd_arenas_tdata_bypassp_get
+#undef tsd_arenas_tdata_get
+#undef tsd_arenas_tdata_set
+#undef tsd_arenas_tdatap_get
+#undef tsd_boot
+#undef tsd_boot0
+#undef tsd_boot1
+#undef tsd_booted
+#undef tsd_booted_get
+#undef tsd_cleanup
+#undef tsd_cleanup_wrapper
+#undef tsd_fetch
+#undef tsd_fetch_impl
+#undef tsd_get
+#undef tsd_get_allocates
+#undef tsd_iarena_get
+#undef tsd_iarena_set
+#undef tsd_iarenap_get
+#undef tsd_initialized
+#undef tsd_init_check_recursion
+#undef tsd_init_finish
+#undef tsd_init_head
+#undef tsd_narenas_tdata_get
+#undef tsd_narenas_tdata_set
+#undef tsd_narenas_tdatap_get
+#undef tsd_wrapper_get
+#undef tsd_wrapper_set
+#undef tsd_nominal
+#undef tsd_prof_tdata_get
+#undef tsd_prof_tdata_set
+#undef tsd_prof_tdatap_get
+#undef tsd_quarantine_get
+#undef tsd_quarantine_set
+#undef tsd_quarantinep_get
+#undef tsd_set
+#undef tsd_tcache_enabled_get
+#undef tsd_tcache_enabled_set
+#undef tsd_tcache_enabledp_get
+#undef tsd_tcache_get
+#undef tsd_tcache_set
+#undef tsd_tcachep_get
+#undef tsd_thread_allocated_get
+#undef tsd_thread_allocated_set
+#undef tsd_thread_allocatedp_get
+#undef tsd_thread_deallocated_get
+#undef tsd_thread_deallocated_set
+#undef tsd_thread_deallocatedp_get
+#undef tsd_tls
+#undef tsd_tsd
+#undef tsd_tsdn
+#undef tsd_witness_fork_get
+#undef tsd_witness_fork_set
+#undef tsd_witness_forkp_get
+#undef tsd_witnesses_get
+#undef tsd_witnesses_set
+#undef tsd_witnessesp_get
+#undef tsdn_fetch
+#undef tsdn_null
+#undef tsdn_tsd
+#undef u2rz
+#undef valgrind_freelike_block
+#undef valgrind_make_mem_defined
+#undef valgrind_make_mem_noaccess
+#undef valgrind_make_mem_undefined
+#undef witness_assert_lockless
+#undef witness_assert_not_owner
+#undef witness_assert_owner
+#undef witness_fork_cleanup
+#undef witness_init
+#undef witness_lock
+#undef witness_lock_error
+#undef witness_lockless_error
+#undef witness_not_owner_error
+#undef witness_owner
+#undef witness_owner_error
+#undef witness_postfork_child
+#undef witness_postfork_parent
+#undef witness_prefork
+#undef witness_unlock
+#undef witnesses_cleanup
+#undef zone_register
diff --git a/include/jemalloc/internal/public_namespace.h b/include/jemalloc/internal/public_namespace.h
new file mode 100644
index 0000000..c43cb61
--- /dev/null
+++ b/include/jemalloc/internal/public_namespace.h
@@ -0,0 +1,22 @@
+#define je_malloc_conf JEMALLOC_N(malloc_conf)
+#define je_malloc_message JEMALLOC_N(malloc_message)
+#define je_malloc JEMALLOC_N(malloc)
+#define je_calloc JEMALLOC_N(calloc)
+#define je_posix_memalign JEMALLOC_N(posix_memalign)
+#define je_aligned_alloc JEMALLOC_N(aligned_alloc)
+#define je_realloc JEMALLOC_N(realloc)
+#define je_free JEMALLOC_N(free)
+#define je_mallocx JEMALLOC_N(mallocx)
+#define je_rallocx JEMALLOC_N(rallocx)
+#define je_xallocx JEMALLOC_N(xallocx)
+#define je_sallocx JEMALLOC_N(sallocx)
+#define je_dallocx JEMALLOC_N(dallocx)
+#define je_sdallocx JEMALLOC_N(sdallocx)
+#define je_nallocx JEMALLOC_N(nallocx)
+#define je_mallctl JEMALLOC_N(mallctl)
+#define je_mallctlnametomib JEMALLOC_N(mallctlnametomib)
+#define je_mallctlbymib JEMALLOC_N(mallctlbymib)
+#define je_malloc_stats_print JEMALLOC_N(malloc_stats_print)
+#define je_malloc_usable_size JEMALLOC_N(malloc_usable_size)
+#define je_memalign JEMALLOC_N(memalign)
+#define je_valloc JEMALLOC_N(valloc)
diff --git a/include/jemalloc/internal/public_symbols.txt b/include/jemalloc/internal/public_symbols.txt
new file mode 100644
index 0000000..d2c566d
--- /dev/null
+++ b/include/jemalloc/internal/public_symbols.txt
@@ -0,0 +1,22 @@
+malloc_conf:je_malloc_conf
+malloc_message:je_malloc_message
+malloc:je_malloc
+calloc:je_calloc
+posix_memalign:je_posix_memalign
+aligned_alloc:je_aligned_alloc
+realloc:je_realloc
+free:je_free
+mallocx:je_mallocx
+rallocx:je_rallocx
+xallocx:je_xallocx
+sallocx:je_sallocx
+dallocx:je_dallocx
+sdallocx:je_sdallocx
+nallocx:je_nallocx
+mallctl:je_mallctl
+mallctlnametomib:je_mallctlnametomib
+mallctlbymib:je_mallctlbymib
+malloc_stats_print:je_malloc_stats_print
+malloc_usable_size:je_malloc_usable_size
+memalign:je_memalign
+valloc:je_valloc
diff --git a/include/jemalloc/internal/public_unnamespace.h b/include/jemalloc/internal/public_unnamespace.h
new file mode 100644
index 0000000..4681948
--- /dev/null
+++ b/include/jemalloc/internal/public_unnamespace.h
@@ -0,0 +1,22 @@
+#undef je_malloc_conf
+#undef je_malloc_message
+#undef je_malloc
+#undef je_calloc
+#undef je_posix_memalign
+#undef je_aligned_alloc
+#undef je_realloc
+#undef je_free
+#undef je_mallocx
+#undef je_rallocx
+#undef je_xallocx
+#undef je_sallocx
+#undef je_dallocx
+#undef je_sdallocx
+#undef je_nallocx
+#undef je_mallctl
+#undef je_mallctlnametomib
+#undef je_mallctlbymib
+#undef je_malloc_stats_print
+#undef je_malloc_usable_size
+#undef je_memalign
+#undef je_valloc
diff --git a/include/jemalloc/internal/size_classes.h b/include/jemalloc/internal/size_classes.h
new file mode 100644
index 0000000..e4edc4b
--- /dev/null
+++ b/include/jemalloc/internal/size_classes.h
@@ -0,0 +1,1428 @@
+/* This file was automatically generated by size_classes.sh. */
+/******************************************************************************/
+#ifdef JEMALLOC_H_TYPES
+
+/*
+ * This header requires LG_SIZEOF_PTR, LG_TINY_MIN, LG_QUANTUM, and LG_PAGE to
+ * be defined prior to inclusion, and it in turn defines:
+ *
+ * LG_SIZE_CLASS_GROUP: Lg of size class count for each size doubling.
+ * SIZE_CLASSES: Complete table of SC(index, lg_grp, lg_delta, ndelta, psz,
+ * bin, lg_delta_lookup) tuples.
+ * index: Size class index.
+ * lg_grp: Lg group base size (no deltas added).
+ * lg_delta: Lg delta to previous size class.
+ * ndelta: Delta multiplier. size == 1<<lg_grp + ndelta<<lg_delta
+ * psz: 'yes' if a multiple of the page size, 'no' otherwise.
+ * bin: 'yes' if a small bin size class, 'no' otherwise.
+ * lg_delta_lookup: Same as lg_delta if a lookup table size class, 'no'
+ * otherwise.
+ * NTBINS: Number of tiny bins.
+ * NLBINS: Number of bins supported by the lookup table.
+ * NBINS: Number of small size class bins.
+ * NSIZES: Number of size classes.
+ * NPSIZES: Number of size classes that are a multiple of (1U << LG_PAGE).
+ * LG_TINY_MAXCLASS: Lg of maximum tiny size class.
+ * LOOKUP_MAXCLASS: Maximum size class included in lookup table.
+ * SMALL_MAXCLASS: Maximum small size class.
+ * LG_LARGE_MINCLASS: Lg of minimum large size class.
+ * HUGE_MAXCLASS: Maximum (huge) size class.
+ */
+
+#define LG_SIZE_CLASS_GROUP 2
+
+#if (LG_SIZEOF_PTR == 2 && LG_TINY_MIN == 3 && LG_QUANTUM == 3 && LG_PAGE == 12)
+#define SIZE_CLASSES \
+ /* index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup */ \
+ SC( 0, 3, 3, 0, no, yes, 3) \
+ SC( 1, 3, 3, 1, no, yes, 3) \
+ SC( 2, 3, 3, 2, no, yes, 3) \
+ SC( 3, 3, 3, 3, no, yes, 3) \
+ \
+ SC( 4, 5, 3, 1, no, yes, 3) \
+ SC( 5, 5, 3, 2, no, yes, 3) \
+ SC( 6, 5, 3, 3, no, yes, 3) \
+ SC( 7, 5, 3, 4, no, yes, 3) \
+ \
+ SC( 8, 6, 4, 1, no, yes, 4) \
+ SC( 9, 6, 4, 2, no, yes, 4) \
+ SC( 10, 6, 4, 3, no, yes, 4) \
+ SC( 11, 6, 4, 4, no, yes, 4) \
+ \
+ SC( 12, 7, 5, 1, no, yes, 5) \
+ SC( 13, 7, 5, 2, no, yes, 5) \
+ SC( 14, 7, 5, 3, no, yes, 5) \
+ SC( 15, 7, 5, 4, no, yes, 5) \
+ \
+ SC( 16, 8, 6, 1, no, yes, 6) \
+ SC( 17, 8, 6, 2, no, yes, 6) \
+ SC( 18, 8, 6, 3, no, yes, 6) \
+ SC( 19, 8, 6, 4, no, yes, 6) \
+ \
+ SC( 20, 9, 7, 1, no, yes, 7) \
+ SC( 21, 9, 7, 2, no, yes, 7) \
+ SC( 22, 9, 7, 3, no, yes, 7) \
+ SC( 23, 9, 7, 4, no, yes, 7) \
+ \
+ SC( 24, 10, 8, 1, no, yes, 8) \
+ SC( 25, 10, 8, 2, no, yes, 8) \
+ SC( 26, 10, 8, 3, no, yes, 8) \
+ SC( 27, 10, 8, 4, no, yes, 8) \
+ \
+ SC( 28, 11, 9, 1, no, yes, 9) \
+ SC( 29, 11, 9, 2, no, yes, 9) \
+ SC( 30, 11, 9, 3, no, yes, 9) \
+ SC( 31, 11, 9, 4, yes, yes, 9) \
+ \
+ SC( 32, 12, 10, 1, no, yes, no) \
+ SC( 33, 12, 10, 2, no, yes, no) \
+ SC( 34, 12, 10, 3, no, yes, no) \
+ SC( 35, 12, 10, 4, yes, yes, no) \
+ \
+ SC( 36, 13, 11, 1, no, yes, no) \
+ SC( 37, 13, 11, 2, yes, yes, no) \
+ SC( 38, 13, 11, 3, no, yes, no) \
+ SC( 39, 13, 11, 4, yes, no, no) \
+ \
+ SC( 40, 14, 12, 1, yes, no, no) \
+ SC( 41, 14, 12, 2, yes, no, no) \
+ SC( 42, 14, 12, 3, yes, no, no) \
+ SC( 43, 14, 12, 4, yes, no, no) \
+ \
+ SC( 44, 15, 13, 1, yes, no, no) \
+ SC( 45, 15, 13, 2, yes, no, no) \
+ SC( 46, 15, 13, 3, yes, no, no) \
+ SC( 47, 15, 13, 4, yes, no, no) \
+ \
+ SC( 48, 16, 14, 1, yes, no, no) \
+ SC( 49, 16, 14, 2, yes, no, no) \
+ SC( 50, 16, 14, 3, yes, no, no) \
+ SC( 51, 16, 14, 4, yes, no, no) \
+ \
+ SC( 52, 17, 15, 1, yes, no, no) \
+ SC( 53, 17, 15, 2, yes, no, no) \
+ SC( 54, 17, 15, 3, yes, no, no) \
+ SC( 55, 17, 15, 4, yes, no, no) \
+ \
+ SC( 56, 18, 16, 1, yes, no, no) \
+ SC( 57, 18, 16, 2, yes, no, no) \
+ SC( 58, 18, 16, 3, yes, no, no) \
+ SC( 59, 18, 16, 4, yes, no, no) \
+ \
+ SC( 60, 19, 17, 1, yes, no, no) \
+ SC( 61, 19, 17, 2, yes, no, no) \
+ SC( 62, 19, 17, 3, yes, no, no) \
+ SC( 63, 19, 17, 4, yes, no, no) \
+ \
+ SC( 64, 20, 18, 1, yes, no, no) \
+ SC( 65, 20, 18, 2, yes, no, no) \
+ SC( 66, 20, 18, 3, yes, no, no) \
+ SC( 67, 20, 18, 4, yes, no, no) \
+ \
+ SC( 68, 21, 19, 1, yes, no, no) \
+ SC( 69, 21, 19, 2, yes, no, no) \
+ SC( 70, 21, 19, 3, yes, no, no) \
+ SC( 71, 21, 19, 4, yes, no, no) \
+ \
+ SC( 72, 22, 20, 1, yes, no, no) \
+ SC( 73, 22, 20, 2, yes, no, no) \
+ SC( 74, 22, 20, 3, yes, no, no) \
+ SC( 75, 22, 20, 4, yes, no, no) \
+ \
+ SC( 76, 23, 21, 1, yes, no, no) \
+ SC( 77, 23, 21, 2, yes, no, no) \
+ SC( 78, 23, 21, 3, yes, no, no) \
+ SC( 79, 23, 21, 4, yes, no, no) \
+ \
+ SC( 80, 24, 22, 1, yes, no, no) \
+ SC( 81, 24, 22, 2, yes, no, no) \
+ SC( 82, 24, 22, 3, yes, no, no) \
+ SC( 83, 24, 22, 4, yes, no, no) \
+ \
+ SC( 84, 25, 23, 1, yes, no, no) \
+ SC( 85, 25, 23, 2, yes, no, no) \
+ SC( 86, 25, 23, 3, yes, no, no) \
+ SC( 87, 25, 23, 4, yes, no, no) \
+ \
+ SC( 88, 26, 24, 1, yes, no, no) \
+ SC( 89, 26, 24, 2, yes, no, no) \
+ SC( 90, 26, 24, 3, yes, no, no) \
+ SC( 91, 26, 24, 4, yes, no, no) \
+ \
+ SC( 92, 27, 25, 1, yes, no, no) \
+ SC( 93, 27, 25, 2, yes, no, no) \
+ SC( 94, 27, 25, 3, yes, no, no) \
+ SC( 95, 27, 25, 4, yes, no, no) \
+ \
+ SC( 96, 28, 26, 1, yes, no, no) \
+ SC( 97, 28, 26, 2, yes, no, no) \
+ SC( 98, 28, 26, 3, yes, no, no) \
+ SC( 99, 28, 26, 4, yes, no, no) \
+ \
+ SC(100, 29, 27, 1, yes, no, no) \
+ SC(101, 29, 27, 2, yes, no, no) \
+ SC(102, 29, 27, 3, yes, no, no) \
+ SC(103, 29, 27, 4, yes, no, no) \
+ \
+ SC(104, 30, 28, 1, yes, no, no) \
+ SC(105, 30, 28, 2, yes, no, no) \
+ SC(106, 30, 28, 3, yes, no, no) \
+
+#define SIZE_CLASSES_DEFINED
+#define NTBINS 0
+#define NLBINS 32
+#define NBINS 39
+#define NSIZES 107
+#define NPSIZES 71
+#define LG_TINY_MAXCLASS "NA"
+#define LOOKUP_MAXCLASS ((((size_t)1) << 11) + (((size_t)4) << 9))
+#define SMALL_MAXCLASS ((((size_t)1) << 13) + (((size_t)3) << 11))
+#define LG_LARGE_MINCLASS 14
+#define HUGE_MAXCLASS ((((size_t)1) << 30) + (((size_t)3) << 28))
+#endif
+
+#if (LG_SIZEOF_PTR == 2 && LG_TINY_MIN == 3 && LG_QUANTUM == 4 && LG_PAGE == 12)
+#define SIZE_CLASSES \
+ /* index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup */ \
+ SC( 0, 3, 3, 0, no, yes, 3) \
+ \
+ SC( 1, 3, 3, 1, no, yes, 3) \
+ SC( 2, 4, 4, 1, no, yes, 4) \
+ SC( 3, 4, 4, 2, no, yes, 4) \
+ SC( 4, 4, 4, 3, no, yes, 4) \
+ \
+ SC( 5, 6, 4, 1, no, yes, 4) \
+ SC( 6, 6, 4, 2, no, yes, 4) \
+ SC( 7, 6, 4, 3, no, yes, 4) \
+ SC( 8, 6, 4, 4, no, yes, 4) \
+ \
+ SC( 9, 7, 5, 1, no, yes, 5) \
+ SC( 10, 7, 5, 2, no, yes, 5) \
+ SC( 11, 7, 5, 3, no, yes, 5) \
+ SC( 12, 7, 5, 4, no, yes, 5) \
+ \
+ SC( 13, 8, 6, 1, no, yes, 6) \
+ SC( 14, 8, 6, 2, no, yes, 6) \
+ SC( 15, 8, 6, 3, no, yes, 6) \
+ SC( 16, 8, 6, 4, no, yes, 6) \
+ \
+ SC( 17, 9, 7, 1, no, yes, 7) \
+ SC( 18, 9, 7, 2, no, yes, 7) \
+ SC( 19, 9, 7, 3, no, yes, 7) \
+ SC( 20, 9, 7, 4, no, yes, 7) \
+ \
+ SC( 21, 10, 8, 1, no, yes, 8) \
+ SC( 22, 10, 8, 2, no, yes, 8) \
+ SC( 23, 10, 8, 3, no, yes, 8) \
+ SC( 24, 10, 8, 4, no, yes, 8) \
+ \
+ SC( 25, 11, 9, 1, no, yes, 9) \
+ SC( 26, 11, 9, 2, no, yes, 9) \
+ SC( 27, 11, 9, 3, no, yes, 9) \
+ SC( 28, 11, 9, 4, yes, yes, 9) \
+ \
+ SC( 29, 12, 10, 1, no, yes, no) \
+ SC( 30, 12, 10, 2, no, yes, no) \
+ SC( 31, 12, 10, 3, no, yes, no) \
+ SC( 32, 12, 10, 4, yes, yes, no) \
+ \
+ SC( 33, 13, 11, 1, no, yes, no) \
+ SC( 34, 13, 11, 2, yes, yes, no) \
+ SC( 35, 13, 11, 3, no, yes, no) \
+ SC( 36, 13, 11, 4, yes, no, no) \
+ \
+ SC( 37, 14, 12, 1, yes, no, no) \
+ SC( 38, 14, 12, 2, yes, no, no) \
+ SC( 39, 14, 12, 3, yes, no, no) \
+ SC( 40, 14, 12, 4, yes, no, no) \
+ \
+ SC( 41, 15, 13, 1, yes, no, no) \
+ SC( 42, 15, 13, 2, yes, no, no) \
+ SC( 43, 15, 13, 3, yes, no, no) \
+ SC( 44, 15, 13, 4, yes, no, no) \
+ \
+ SC( 45, 16, 14, 1, yes, no, no) \
+ SC( 46, 16, 14, 2, yes, no, no) \
+ SC( 47, 16, 14, 3, yes, no, no) \
+ SC( 48, 16, 14, 4, yes, no, no) \
+ \
+ SC( 49, 17, 15, 1, yes, no, no) \
+ SC( 50, 17, 15, 2, yes, no, no) \
+ SC( 51, 17, 15, 3, yes, no, no) \
+ SC( 52, 17, 15, 4, yes, no, no) \
+ \
+ SC( 53, 18, 16, 1, yes, no, no) \
+ SC( 54, 18, 16, 2, yes, no, no) \
+ SC( 55, 18, 16, 3, yes, no, no) \
+ SC( 56, 18, 16, 4, yes, no, no) \
+ \
+ SC( 57, 19, 17, 1, yes, no, no) \
+ SC( 58, 19, 17, 2, yes, no, no) \
+ SC( 59, 19, 17, 3, yes, no, no) \
+ SC( 60, 19, 17, 4, yes, no, no) \
+ \
+ SC( 61, 20, 18, 1, yes, no, no) \
+ SC( 62, 20, 18, 2, yes, no, no) \
+ SC( 63, 20, 18, 3, yes, no, no) \
+ SC( 64, 20, 18, 4, yes, no, no) \
+ \
+ SC( 65, 21, 19, 1, yes, no, no) \
+ SC( 66, 21, 19, 2, yes, no, no) \
+ SC( 67, 21, 19, 3, yes, no, no) \
+ SC( 68, 21, 19, 4, yes, no, no) \
+ \
+ SC( 69, 22, 20, 1, yes, no, no) \
+ SC( 70, 22, 20, 2, yes, no, no) \
+ SC( 71, 22, 20, 3, yes, no, no) \
+ SC( 72, 22, 20, 4, yes, no, no) \
+ \
+ SC( 73, 23, 21, 1, yes, no, no) \
+ SC( 74, 23, 21, 2, yes, no, no) \
+ SC( 75, 23, 21, 3, yes, no, no) \
+ SC( 76, 23, 21, 4, yes, no, no) \
+ \
+ SC( 77, 24, 22, 1, yes, no, no) \
+ SC( 78, 24, 22, 2, yes, no, no) \
+ SC( 79, 24, 22, 3, yes, no, no) \
+ SC( 80, 24, 22, 4, yes, no, no) \
+ \
+ SC( 81, 25, 23, 1, yes, no, no) \
+ SC( 82, 25, 23, 2, yes, no, no) \
+ SC( 83, 25, 23, 3, yes, no, no) \
+ SC( 84, 25, 23, 4, yes, no, no) \
+ \
+ SC( 85, 26, 24, 1, yes, no, no) \
+ SC( 86, 26, 24, 2, yes, no, no) \
+ SC( 87, 26, 24, 3, yes, no, no) \
+ SC( 88, 26, 24, 4, yes, no, no) \
+ \
+ SC( 89, 27, 25, 1, yes, no, no) \
+ SC( 90, 27, 25, 2, yes, no, no) \
+ SC( 91, 27, 25, 3, yes, no, no) \
+ SC( 92, 27, 25, 4, yes, no, no) \
+ \
+ SC( 93, 28, 26, 1, yes, no, no) \
+ SC( 94, 28, 26, 2, yes, no, no) \
+ SC( 95, 28, 26, 3, yes, no, no) \
+ SC( 96, 28, 26, 4, yes, no, no) \
+ \
+ SC( 97, 29, 27, 1, yes, no, no) \
+ SC( 98, 29, 27, 2, yes, no, no) \
+ SC( 99, 29, 27, 3, yes, no, no) \
+ SC(100, 29, 27, 4, yes, no, no) \
+ \
+ SC(101, 30, 28, 1, yes, no, no) \
+ SC(102, 30, 28, 2, yes, no, no) \
+ SC(103, 30, 28, 3, yes, no, no) \
+
+#define SIZE_CLASSES_DEFINED
+#define NTBINS 1
+#define NLBINS 29
+#define NBINS 36
+#define NSIZES 104
+#define NPSIZES 71
+#define LG_TINY_MAXCLASS 3
+#define LOOKUP_MAXCLASS ((((size_t)1) << 11) + (((size_t)4) << 9))
+#define SMALL_MAXCLASS ((((size_t)1) << 13) + (((size_t)3) << 11))
+#define LG_LARGE_MINCLASS 14
+#define HUGE_MAXCLASS ((((size_t)1) << 30) + (((size_t)3) << 28))
+#endif
+
+#if (LG_SIZEOF_PTR == 2 && LG_TINY_MIN == 4 && LG_QUANTUM == 4 && LG_PAGE == 12)
+#define SIZE_CLASSES \
+ /* index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup */ \
+ SC( 0, 4, 4, 0, no, yes, 4) \
+ SC( 1, 4, 4, 1, no, yes, 4) \
+ SC( 2, 4, 4, 2, no, yes, 4) \
+ SC( 3, 4, 4, 3, no, yes, 4) \
+ \
+ SC( 4, 6, 4, 1, no, yes, 4) \
+ SC( 5, 6, 4, 2, no, yes, 4) \
+ SC( 6, 6, 4, 3, no, yes, 4) \
+ SC( 7, 6, 4, 4, no, yes, 4) \
+ \
+ SC( 8, 7, 5, 1, no, yes, 5) \
+ SC( 9, 7, 5, 2, no, yes, 5) \
+ SC( 10, 7, 5, 3, no, yes, 5) \
+ SC( 11, 7, 5, 4, no, yes, 5) \
+ \
+ SC( 12, 8, 6, 1, no, yes, 6) \
+ SC( 13, 8, 6, 2, no, yes, 6) \
+ SC( 14, 8, 6, 3, no, yes, 6) \
+ SC( 15, 8, 6, 4, no, yes, 6) \
+ \
+ SC( 16, 9, 7, 1, no, yes, 7) \
+ SC( 17, 9, 7, 2, no, yes, 7) \
+ SC( 18, 9, 7, 3, no, yes, 7) \
+ SC( 19, 9, 7, 4, no, yes, 7) \
+ \
+ SC( 20, 10, 8, 1, no, yes, 8) \
+ SC( 21, 10, 8, 2, no, yes, 8) \
+ SC( 22, 10, 8, 3, no, yes, 8) \
+ SC( 23, 10, 8, 4, no, yes, 8) \
+ \
+ SC( 24, 11, 9, 1, no, yes, 9) \
+ SC( 25, 11, 9, 2, no, yes, 9) \
+ SC( 26, 11, 9, 3, no, yes, 9) \
+ SC( 27, 11, 9, 4, yes, yes, 9) \
+ \
+ SC( 28, 12, 10, 1, no, yes, no) \
+ SC( 29, 12, 10, 2, no, yes, no) \
+ SC( 30, 12, 10, 3, no, yes, no) \
+ SC( 31, 12, 10, 4, yes, yes, no) \
+ \
+ SC( 32, 13, 11, 1, no, yes, no) \
+ SC( 33, 13, 11, 2, yes, yes, no) \
+ SC( 34, 13, 11, 3, no, yes, no) \
+ SC( 35, 13, 11, 4, yes, no, no) \
+ \
+ SC( 36, 14, 12, 1, yes, no, no) \
+ SC( 37, 14, 12, 2, yes, no, no) \
+ SC( 38, 14, 12, 3, yes, no, no) \
+ SC( 39, 14, 12, 4, yes, no, no) \
+ \
+ SC( 40, 15, 13, 1, yes, no, no) \
+ SC( 41, 15, 13, 2, yes, no, no) \
+ SC( 42, 15, 13, 3, yes, no, no) \
+ SC( 43, 15, 13, 4, yes, no, no) \
+ \
+ SC( 44, 16, 14, 1, yes, no, no) \
+ SC( 45, 16, 14, 2, yes, no, no) \
+ SC( 46, 16, 14, 3, yes, no, no) \
+ SC( 47, 16, 14, 4, yes, no, no) \
+ \
+ SC( 48, 17, 15, 1, yes, no, no) \
+ SC( 49, 17, 15, 2, yes, no, no) \
+ SC( 50, 17, 15, 3, yes, no, no) \
+ SC( 51, 17, 15, 4, yes, no, no) \
+ \
+ SC( 52, 18, 16, 1, yes, no, no) \
+ SC( 53, 18, 16, 2, yes, no, no) \
+ SC( 54, 18, 16, 3, yes, no, no) \
+ SC( 55, 18, 16, 4, yes, no, no) \
+ \
+ SC( 56, 19, 17, 1, yes, no, no) \
+ SC( 57, 19, 17, 2, yes, no, no) \
+ SC( 58, 19, 17, 3, yes, no, no) \
+ SC( 59, 19, 17, 4, yes, no, no) \
+ \
+ SC( 60, 20, 18, 1, yes, no, no) \
+ SC( 61, 20, 18, 2, yes, no, no) \
+ SC( 62, 20, 18, 3, yes, no, no) \
+ SC( 63, 20, 18, 4, yes, no, no) \
+ \
+ SC( 64, 21, 19, 1, yes, no, no) \
+ SC( 65, 21, 19, 2, yes, no, no) \
+ SC( 66, 21, 19, 3, yes, no, no) \
+ SC( 67, 21, 19, 4, yes, no, no) \
+ \
+ SC( 68, 22, 20, 1, yes, no, no) \
+ SC( 69, 22, 20, 2, yes, no, no) \
+ SC( 70, 22, 20, 3, yes, no, no) \
+ SC( 71, 22, 20, 4, yes, no, no) \
+ \
+ SC( 72, 23, 21, 1, yes, no, no) \
+ SC( 73, 23, 21, 2, yes, no, no) \
+ SC( 74, 23, 21, 3, yes, no, no) \
+ SC( 75, 23, 21, 4, yes, no, no) \
+ \
+ SC( 76, 24, 22, 1, yes, no, no) \
+ SC( 77, 24, 22, 2, yes, no, no) \
+ SC( 78, 24, 22, 3, yes, no, no) \
+ SC( 79, 24, 22, 4, yes, no, no) \
+ \
+ SC( 80, 25, 23, 1, yes, no, no) \
+ SC( 81, 25, 23, 2, yes, no, no) \
+ SC( 82, 25, 23, 3, yes, no, no) \
+ SC( 83, 25, 23, 4, yes, no, no) \
+ \
+ SC( 84, 26, 24, 1, yes, no, no) \
+ SC( 85, 26, 24, 2, yes, no, no) \
+ SC( 86, 26, 24, 3, yes, no, no) \
+ SC( 87, 26, 24, 4, yes, no, no) \
+ \
+ SC( 88, 27, 25, 1, yes, no, no) \
+ SC( 89, 27, 25, 2, yes, no, no) \
+ SC( 90, 27, 25, 3, yes, no, no) \
+ SC( 91, 27, 25, 4, yes, no, no) \
+ \
+ SC( 92, 28, 26, 1, yes, no, no) \
+ SC( 93, 28, 26, 2, yes, no, no) \
+ SC( 94, 28, 26, 3, yes, no, no) \
+ SC( 95, 28, 26, 4, yes, no, no) \
+ \
+ SC( 96, 29, 27, 1, yes, no, no) \
+ SC( 97, 29, 27, 2, yes, no, no) \
+ SC( 98, 29, 27, 3, yes, no, no) \
+ SC( 99, 29, 27, 4, yes, no, no) \
+ \
+ SC(100, 30, 28, 1, yes, no, no) \
+ SC(101, 30, 28, 2, yes, no, no) \
+ SC(102, 30, 28, 3, yes, no, no) \
+
+#define SIZE_CLASSES_DEFINED
+#define NTBINS 0
+#define NLBINS 28
+#define NBINS 35
+#define NSIZES 103
+#define NPSIZES 71
+#define LG_TINY_MAXCLASS "NA"
+#define LOOKUP_MAXCLASS ((((size_t)1) << 11) + (((size_t)4) << 9))
+#define SMALL_MAXCLASS ((((size_t)1) << 13) + (((size_t)3) << 11))
+#define LG_LARGE_MINCLASS 14
+#define HUGE_MAXCLASS ((((size_t)1) << 30) + (((size_t)3) << 28))
+#endif
+
+#if (LG_SIZEOF_PTR == 3 && LG_TINY_MIN == 3 && LG_QUANTUM == 3 && LG_PAGE == 12)
+#define SIZE_CLASSES \
+ /* index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup */ \
+ SC( 0, 3, 3, 0, no, yes, 3) \
+ SC( 1, 3, 3, 1, no, yes, 3) \
+ SC( 2, 3, 3, 2, no, yes, 3) \
+ SC( 3, 3, 3, 3, no, yes, 3) \
+ \
+ SC( 4, 5, 3, 1, no, yes, 3) \
+ SC( 5, 5, 3, 2, no, yes, 3) \
+ SC( 6, 5, 3, 3, no, yes, 3) \
+ SC( 7, 5, 3, 4, no, yes, 3) \
+ \
+ SC( 8, 6, 4, 1, no, yes, 4) \
+ SC( 9, 6, 4, 2, no, yes, 4) \
+ SC( 10, 6, 4, 3, no, yes, 4) \
+ SC( 11, 6, 4, 4, no, yes, 4) \
+ \
+ SC( 12, 7, 5, 1, no, yes, 5) \
+ SC( 13, 7, 5, 2, no, yes, 5) \
+ SC( 14, 7, 5, 3, no, yes, 5) \
+ SC( 15, 7, 5, 4, no, yes, 5) \
+ \
+ SC( 16, 8, 6, 1, no, yes, 6) \
+ SC( 17, 8, 6, 2, no, yes, 6) \
+ SC( 18, 8, 6, 3, no, yes, 6) \
+ SC( 19, 8, 6, 4, no, yes, 6) \
+ \
+ SC( 20, 9, 7, 1, no, yes, 7) \
+ SC( 21, 9, 7, 2, no, yes, 7) \
+ SC( 22, 9, 7, 3, no, yes, 7) \
+ SC( 23, 9, 7, 4, no, yes, 7) \
+ \
+ SC( 24, 10, 8, 1, no, yes, 8) \
+ SC( 25, 10, 8, 2, no, yes, 8) \
+ SC( 26, 10, 8, 3, no, yes, 8) \
+ SC( 27, 10, 8, 4, no, yes, 8) \
+ \
+ SC( 28, 11, 9, 1, no, yes, 9) \
+ SC( 29, 11, 9, 2, no, yes, 9) \
+ SC( 30, 11, 9, 3, no, yes, 9) \
+ SC( 31, 11, 9, 4, yes, yes, 9) \
+ \
+ SC( 32, 12, 10, 1, no, yes, no) \
+ SC( 33, 12, 10, 2, no, yes, no) \
+ SC( 34, 12, 10, 3, no, yes, no) \
+ SC( 35, 12, 10, 4, yes, yes, no) \
+ \
+ SC( 36, 13, 11, 1, no, yes, no) \
+ SC( 37, 13, 11, 2, yes, yes, no) \
+ SC( 38, 13, 11, 3, no, yes, no) \
+ SC( 39, 13, 11, 4, yes, no, no) \
+ \
+ SC( 40, 14, 12, 1, yes, no, no) \
+ SC( 41, 14, 12, 2, yes, no, no) \
+ SC( 42, 14, 12, 3, yes, no, no) \
+ SC( 43, 14, 12, 4, yes, no, no) \
+ \
+ SC( 44, 15, 13, 1, yes, no, no) \
+ SC( 45, 15, 13, 2, yes, no, no) \
+ SC( 46, 15, 13, 3, yes, no, no) \
+ SC( 47, 15, 13, 4, yes, no, no) \
+ \
+ SC( 48, 16, 14, 1, yes, no, no) \
+ SC( 49, 16, 14, 2, yes, no, no) \
+ SC( 50, 16, 14, 3, yes, no, no) \
+ SC( 51, 16, 14, 4, yes, no, no) \
+ \
+ SC( 52, 17, 15, 1, yes, no, no) \
+ SC( 53, 17, 15, 2, yes, no, no) \
+ SC( 54, 17, 15, 3, yes, no, no) \
+ SC( 55, 17, 15, 4, yes, no, no) \
+ \
+ SC( 56, 18, 16, 1, yes, no, no) \
+ SC( 57, 18, 16, 2, yes, no, no) \
+ SC( 58, 18, 16, 3, yes, no, no) \
+ SC( 59, 18, 16, 4, yes, no, no) \
+ \
+ SC( 60, 19, 17, 1, yes, no, no) \
+ SC( 61, 19, 17, 2, yes, no, no) \
+ SC( 62, 19, 17, 3, yes, no, no) \
+ SC( 63, 19, 17, 4, yes, no, no) \
+ \
+ SC( 64, 20, 18, 1, yes, no, no) \
+ SC( 65, 20, 18, 2, yes, no, no) \
+ SC( 66, 20, 18, 3, yes, no, no) \
+ SC( 67, 20, 18, 4, yes, no, no) \
+ \
+ SC( 68, 21, 19, 1, yes, no, no) \
+ SC( 69, 21, 19, 2, yes, no, no) \
+ SC( 70, 21, 19, 3, yes, no, no) \
+ SC( 71, 21, 19, 4, yes, no, no) \
+ \
+ SC( 72, 22, 20, 1, yes, no, no) \
+ SC( 73, 22, 20, 2, yes, no, no) \
+ SC( 74, 22, 20, 3, yes, no, no) \
+ SC( 75, 22, 20, 4, yes, no, no) \
+ \
+ SC( 76, 23, 21, 1, yes, no, no) \
+ SC( 77, 23, 21, 2, yes, no, no) \
+ SC( 78, 23, 21, 3, yes, no, no) \
+ SC( 79, 23, 21, 4, yes, no, no) \
+ \
+ SC( 80, 24, 22, 1, yes, no, no) \
+ SC( 81, 24, 22, 2, yes, no, no) \
+ SC( 82, 24, 22, 3, yes, no, no) \
+ SC( 83, 24, 22, 4, yes, no, no) \
+ \
+ SC( 84, 25, 23, 1, yes, no, no) \
+ SC( 85, 25, 23, 2, yes, no, no) \
+ SC( 86, 25, 23, 3, yes, no, no) \
+ SC( 87, 25, 23, 4, yes, no, no) \
+ \
+ SC( 88, 26, 24, 1, yes, no, no) \
+ SC( 89, 26, 24, 2, yes, no, no) \
+ SC( 90, 26, 24, 3, yes, no, no) \
+ SC( 91, 26, 24, 4, yes, no, no) \
+ \
+ SC( 92, 27, 25, 1, yes, no, no) \
+ SC( 93, 27, 25, 2, yes, no, no) \
+ SC( 94, 27, 25, 3, yes, no, no) \
+ SC( 95, 27, 25, 4, yes, no, no) \
+ \
+ SC( 96, 28, 26, 1, yes, no, no) \
+ SC( 97, 28, 26, 2, yes, no, no) \
+ SC( 98, 28, 26, 3, yes, no, no) \
+ SC( 99, 28, 26, 4, yes, no, no) \
+ \
+ SC(100, 29, 27, 1, yes, no, no) \
+ SC(101, 29, 27, 2, yes, no, no) \
+ SC(102, 29, 27, 3, yes, no, no) \
+ SC(103, 29, 27, 4, yes, no, no) \
+ \
+ SC(104, 30, 28, 1, yes, no, no) \
+ SC(105, 30, 28, 2, yes, no, no) \
+ SC(106, 30, 28, 3, yes, no, no) \
+ SC(107, 30, 28, 4, yes, no, no) \
+ \
+ SC(108, 31, 29, 1, yes, no, no) \
+ SC(109, 31, 29, 2, yes, no, no) \
+ SC(110, 31, 29, 3, yes, no, no) \
+ SC(111, 31, 29, 4, yes, no, no) \
+ \
+ SC(112, 32, 30, 1, yes, no, no) \
+ SC(113, 32, 30, 2, yes, no, no) \
+ SC(114, 32, 30, 3, yes, no, no) \
+ SC(115, 32, 30, 4, yes, no, no) \
+ \
+ SC(116, 33, 31, 1, yes, no, no) \
+ SC(117, 33, 31, 2, yes, no, no) \
+ SC(118, 33, 31, 3, yes, no, no) \
+ SC(119, 33, 31, 4, yes, no, no) \
+ \
+ SC(120, 34, 32, 1, yes, no, no) \
+ SC(121, 34, 32, 2, yes, no, no) \
+ SC(122, 34, 32, 3, yes, no, no) \
+ SC(123, 34, 32, 4, yes, no, no) \
+ \
+ SC(124, 35, 33, 1, yes, no, no) \
+ SC(125, 35, 33, 2, yes, no, no) \
+ SC(126, 35, 33, 3, yes, no, no) \
+ SC(127, 35, 33, 4, yes, no, no) \
+ \
+ SC(128, 36, 34, 1, yes, no, no) \
+ SC(129, 36, 34, 2, yes, no, no) \
+ SC(130, 36, 34, 3, yes, no, no) \
+ SC(131, 36, 34, 4, yes, no, no) \
+ \
+ SC(132, 37, 35, 1, yes, no, no) \
+ SC(133, 37, 35, 2, yes, no, no) \
+ SC(134, 37, 35, 3, yes, no, no) \
+ SC(135, 37, 35, 4, yes, no, no) \
+ \
+ SC(136, 38, 36, 1, yes, no, no) \
+ SC(137, 38, 36, 2, yes, no, no) \
+ SC(138, 38, 36, 3, yes, no, no) \
+ SC(139, 38, 36, 4, yes, no, no) \
+ \
+ SC(140, 39, 37, 1, yes, no, no) \
+ SC(141, 39, 37, 2, yes, no, no) \
+ SC(142, 39, 37, 3, yes, no, no) \
+ SC(143, 39, 37, 4, yes, no, no) \
+ \
+ SC(144, 40, 38, 1, yes, no, no) \
+ SC(145, 40, 38, 2, yes, no, no) \
+ SC(146, 40, 38, 3, yes, no, no) \
+ SC(147, 40, 38, 4, yes, no, no) \
+ \
+ SC(148, 41, 39, 1, yes, no, no) \
+ SC(149, 41, 39, 2, yes, no, no) \
+ SC(150, 41, 39, 3, yes, no, no) \
+ SC(151, 41, 39, 4, yes, no, no) \
+ \
+ SC(152, 42, 40, 1, yes, no, no) \
+ SC(153, 42, 40, 2, yes, no, no) \
+ SC(154, 42, 40, 3, yes, no, no) \
+ SC(155, 42, 40, 4, yes, no, no) \
+ \
+ SC(156, 43, 41, 1, yes, no, no) \
+ SC(157, 43, 41, 2, yes, no, no) \
+ SC(158, 43, 41, 3, yes, no, no) \
+ SC(159, 43, 41, 4, yes, no, no) \
+ \
+ SC(160, 44, 42, 1, yes, no, no) \
+ SC(161, 44, 42, 2, yes, no, no) \
+ SC(162, 44, 42, 3, yes, no, no) \
+ SC(163, 44, 42, 4, yes, no, no) \
+ \
+ SC(164, 45, 43, 1, yes, no, no) \
+ SC(165, 45, 43, 2, yes, no, no) \
+ SC(166, 45, 43, 3, yes, no, no) \
+ SC(167, 45, 43, 4, yes, no, no) \
+ \
+ SC(168, 46, 44, 1, yes, no, no) \
+ SC(169, 46, 44, 2, yes, no, no) \
+ SC(170, 46, 44, 3, yes, no, no) \
+ SC(171, 46, 44, 4, yes, no, no) \
+ \
+ SC(172, 47, 45, 1, yes, no, no) \
+ SC(173, 47, 45, 2, yes, no, no) \
+ SC(174, 47, 45, 3, yes, no, no) \
+ SC(175, 47, 45, 4, yes, no, no) \
+ \
+ SC(176, 48, 46, 1, yes, no, no) \
+ SC(177, 48, 46, 2, yes, no, no) \
+ SC(178, 48, 46, 3, yes, no, no) \
+ SC(179, 48, 46, 4, yes, no, no) \
+ \
+ SC(180, 49, 47, 1, yes, no, no) \
+ SC(181, 49, 47, 2, yes, no, no) \
+ SC(182, 49, 47, 3, yes, no, no) \
+ SC(183, 49, 47, 4, yes, no, no) \
+ \
+ SC(184, 50, 48, 1, yes, no, no) \
+ SC(185, 50, 48, 2, yes, no, no) \
+ SC(186, 50, 48, 3, yes, no, no) \
+ SC(187, 50, 48, 4, yes, no, no) \
+ \
+ SC(188, 51, 49, 1, yes, no, no) \
+ SC(189, 51, 49, 2, yes, no, no) \
+ SC(190, 51, 49, 3, yes, no, no) \
+ SC(191, 51, 49, 4, yes, no, no) \
+ \
+ SC(192, 52, 50, 1, yes, no, no) \
+ SC(193, 52, 50, 2, yes, no, no) \
+ SC(194, 52, 50, 3, yes, no, no) \
+ SC(195, 52, 50, 4, yes, no, no) \
+ \
+ SC(196, 53, 51, 1, yes, no, no) \
+ SC(197, 53, 51, 2, yes, no, no) \
+ SC(198, 53, 51, 3, yes, no, no) \
+ SC(199, 53, 51, 4, yes, no, no) \
+ \
+ SC(200, 54, 52, 1, yes, no, no) \
+ SC(201, 54, 52, 2, yes, no, no) \
+ SC(202, 54, 52, 3, yes, no, no) \
+ SC(203, 54, 52, 4, yes, no, no) \
+ \
+ SC(204, 55, 53, 1, yes, no, no) \
+ SC(205, 55, 53, 2, yes, no, no) \
+ SC(206, 55, 53, 3, yes, no, no) \
+ SC(207, 55, 53, 4, yes, no, no) \
+ \
+ SC(208, 56, 54, 1, yes, no, no) \
+ SC(209, 56, 54, 2, yes, no, no) \
+ SC(210, 56, 54, 3, yes, no, no) \
+ SC(211, 56, 54, 4, yes, no, no) \
+ \
+ SC(212, 57, 55, 1, yes, no, no) \
+ SC(213, 57, 55, 2, yes, no, no) \
+ SC(214, 57, 55, 3, yes, no, no) \
+ SC(215, 57, 55, 4, yes, no, no) \
+ \
+ SC(216, 58, 56, 1, yes, no, no) \
+ SC(217, 58, 56, 2, yes, no, no) \
+ SC(218, 58, 56, 3, yes, no, no) \
+ SC(219, 58, 56, 4, yes, no, no) \
+ \
+ SC(220, 59, 57, 1, yes, no, no) \
+ SC(221, 59, 57, 2, yes, no, no) \
+ SC(222, 59, 57, 3, yes, no, no) \
+ SC(223, 59, 57, 4, yes, no, no) \
+ \
+ SC(224, 60, 58, 1, yes, no, no) \
+ SC(225, 60, 58, 2, yes, no, no) \
+ SC(226, 60, 58, 3, yes, no, no) \
+ SC(227, 60, 58, 4, yes, no, no) \
+ \
+ SC(228, 61, 59, 1, yes, no, no) \
+ SC(229, 61, 59, 2, yes, no, no) \
+ SC(230, 61, 59, 3, yes, no, no) \
+ SC(231, 61, 59, 4, yes, no, no) \
+ \
+ SC(232, 62, 60, 1, yes, no, no) \
+ SC(233, 62, 60, 2, yes, no, no) \
+ SC(234, 62, 60, 3, yes, no, no) \
+
+#define SIZE_CLASSES_DEFINED
+#define NTBINS 0
+#define NLBINS 32
+#define NBINS 39
+#define NSIZES 235
+#define NPSIZES 199
+#define LG_TINY_MAXCLASS "NA"
+#define LOOKUP_MAXCLASS ((((size_t)1) << 11) + (((size_t)4) << 9))
+#define SMALL_MAXCLASS ((((size_t)1) << 13) + (((size_t)3) << 11))
+#define LG_LARGE_MINCLASS 14
+#define HUGE_MAXCLASS ((((size_t)1) << 62) + (((size_t)3) << 60))
+#endif
+
+#if (LG_SIZEOF_PTR == 3 && LG_TINY_MIN == 3 && LG_QUANTUM == 4 && LG_PAGE == 12)
+#define SIZE_CLASSES \
+ /* index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup */ \
+ SC( 0, 3, 3, 0, no, yes, 3) \
+ \
+ SC( 1, 3, 3, 1, no, yes, 3) \
+ SC( 2, 4, 4, 1, no, yes, 4) \
+ SC( 3, 4, 4, 2, no, yes, 4) \
+ SC( 4, 4, 4, 3, no, yes, 4) \
+ \
+ SC( 5, 6, 4, 1, no, yes, 4) \
+ SC( 6, 6, 4, 2, no, yes, 4) \
+ SC( 7, 6, 4, 3, no, yes, 4) \
+ SC( 8, 6, 4, 4, no, yes, 4) \
+ \
+ SC( 9, 7, 5, 1, no, yes, 5) \
+ SC( 10, 7, 5, 2, no, yes, 5) \
+ SC( 11, 7, 5, 3, no, yes, 5) \
+ SC( 12, 7, 5, 4, no, yes, 5) \
+ \
+ SC( 13, 8, 6, 1, no, yes, 6) \
+ SC( 14, 8, 6, 2, no, yes, 6) \
+ SC( 15, 8, 6, 3, no, yes, 6) \
+ SC( 16, 8, 6, 4, no, yes, 6) \
+ \
+ SC( 17, 9, 7, 1, no, yes, 7) \
+ SC( 18, 9, 7, 2, no, yes, 7) \
+ SC( 19, 9, 7, 3, no, yes, 7) \
+ SC( 20, 9, 7, 4, no, yes, 7) \
+ \
+ SC( 21, 10, 8, 1, no, yes, 8) \
+ SC( 22, 10, 8, 2, no, yes, 8) \
+ SC( 23, 10, 8, 3, no, yes, 8) \
+ SC( 24, 10, 8, 4, no, yes, 8) \
+ \
+ SC( 25, 11, 9, 1, no, yes, 9) \
+ SC( 26, 11, 9, 2, no, yes, 9) \
+ SC( 27, 11, 9, 3, no, yes, 9) \
+ SC( 28, 11, 9, 4, yes, yes, 9) \
+ \
+ SC( 29, 12, 10, 1, no, yes, no) \
+ SC( 30, 12, 10, 2, no, yes, no) \
+ SC( 31, 12, 10, 3, no, yes, no) \
+ SC( 32, 12, 10, 4, yes, yes, no) \
+ \
+ SC( 33, 13, 11, 1, no, yes, no) \
+ SC( 34, 13, 11, 2, yes, yes, no) \
+ SC( 35, 13, 11, 3, no, yes, no) \
+ SC( 36, 13, 11, 4, yes, no, no) \
+ \
+ SC( 37, 14, 12, 1, yes, no, no) \
+ SC( 38, 14, 12, 2, yes, no, no) \
+ SC( 39, 14, 12, 3, yes, no, no) \
+ SC( 40, 14, 12, 4, yes, no, no) \
+ \
+ SC( 41, 15, 13, 1, yes, no, no) \
+ SC( 42, 15, 13, 2, yes, no, no) \
+ SC( 43, 15, 13, 3, yes, no, no) \
+ SC( 44, 15, 13, 4, yes, no, no) \
+ \
+ SC( 45, 16, 14, 1, yes, no, no) \
+ SC( 46, 16, 14, 2, yes, no, no) \
+ SC( 47, 16, 14, 3, yes, no, no) \
+ SC( 48, 16, 14, 4, yes, no, no) \
+ \
+ SC( 49, 17, 15, 1, yes, no, no) \
+ SC( 50, 17, 15, 2, yes, no, no) \
+ SC( 51, 17, 15, 3, yes, no, no) \
+ SC( 52, 17, 15, 4, yes, no, no) \
+ \
+ SC( 53, 18, 16, 1, yes, no, no) \
+ SC( 54, 18, 16, 2, yes, no, no) \
+ SC( 55, 18, 16, 3, yes, no, no) \
+ SC( 56, 18, 16, 4, yes, no, no) \
+ \
+ SC( 57, 19, 17, 1, yes, no, no) \
+ SC( 58, 19, 17, 2, yes, no, no) \
+ SC( 59, 19, 17, 3, yes, no, no) \
+ SC( 60, 19, 17, 4, yes, no, no) \
+ \
+ SC( 61, 20, 18, 1, yes, no, no) \
+ SC( 62, 20, 18, 2, yes, no, no) \
+ SC( 63, 20, 18, 3, yes, no, no) \
+ SC( 64, 20, 18, 4, yes, no, no) \
+ \
+ SC( 65, 21, 19, 1, yes, no, no) \
+ SC( 66, 21, 19, 2, yes, no, no) \
+ SC( 67, 21, 19, 3, yes, no, no) \
+ SC( 68, 21, 19, 4, yes, no, no) \
+ \
+ SC( 69, 22, 20, 1, yes, no, no) \
+ SC( 70, 22, 20, 2, yes, no, no) \
+ SC( 71, 22, 20, 3, yes, no, no) \
+ SC( 72, 22, 20, 4, yes, no, no) \
+ \
+ SC( 73, 23, 21, 1, yes, no, no) \
+ SC( 74, 23, 21, 2, yes, no, no) \
+ SC( 75, 23, 21, 3, yes, no, no) \
+ SC( 76, 23, 21, 4, yes, no, no) \
+ \
+ SC( 77, 24, 22, 1, yes, no, no) \
+ SC( 78, 24, 22, 2, yes, no, no) \
+ SC( 79, 24, 22, 3, yes, no, no) \
+ SC( 80, 24, 22, 4, yes, no, no) \
+ \
+ SC( 81, 25, 23, 1, yes, no, no) \
+ SC( 82, 25, 23, 2, yes, no, no) \
+ SC( 83, 25, 23, 3, yes, no, no) \
+ SC( 84, 25, 23, 4, yes, no, no) \
+ \
+ SC( 85, 26, 24, 1, yes, no, no) \
+ SC( 86, 26, 24, 2, yes, no, no) \
+ SC( 87, 26, 24, 3, yes, no, no) \
+ SC( 88, 26, 24, 4, yes, no, no) \
+ \
+ SC( 89, 27, 25, 1, yes, no, no) \
+ SC( 90, 27, 25, 2, yes, no, no) \
+ SC( 91, 27, 25, 3, yes, no, no) \
+ SC( 92, 27, 25, 4, yes, no, no) \
+ \
+ SC( 93, 28, 26, 1, yes, no, no) \
+ SC( 94, 28, 26, 2, yes, no, no) \
+ SC( 95, 28, 26, 3, yes, no, no) \
+ SC( 96, 28, 26, 4, yes, no, no) \
+ \
+ SC( 97, 29, 27, 1, yes, no, no) \
+ SC( 98, 29, 27, 2, yes, no, no) \
+ SC( 99, 29, 27, 3, yes, no, no) \
+ SC(100, 29, 27, 4, yes, no, no) \
+ \
+ SC(101, 30, 28, 1, yes, no, no) \
+ SC(102, 30, 28, 2, yes, no, no) \
+ SC(103, 30, 28, 3, yes, no, no) \
+ SC(104, 30, 28, 4, yes, no, no) \
+ \
+ SC(105, 31, 29, 1, yes, no, no) \
+ SC(106, 31, 29, 2, yes, no, no) \
+ SC(107, 31, 29, 3, yes, no, no) \
+ SC(108, 31, 29, 4, yes, no, no) \
+ \
+ SC(109, 32, 30, 1, yes, no, no) \
+ SC(110, 32, 30, 2, yes, no, no) \
+ SC(111, 32, 30, 3, yes, no, no) \
+ SC(112, 32, 30, 4, yes, no, no) \
+ \
+ SC(113, 33, 31, 1, yes, no, no) \
+ SC(114, 33, 31, 2, yes, no, no) \
+ SC(115, 33, 31, 3, yes, no, no) \
+ SC(116, 33, 31, 4, yes, no, no) \
+ \
+ SC(117, 34, 32, 1, yes, no, no) \
+ SC(118, 34, 32, 2, yes, no, no) \
+ SC(119, 34, 32, 3, yes, no, no) \
+ SC(120, 34, 32, 4, yes, no, no) \
+ \
+ SC(121, 35, 33, 1, yes, no, no) \
+ SC(122, 35, 33, 2, yes, no, no) \
+ SC(123, 35, 33, 3, yes, no, no) \
+ SC(124, 35, 33, 4, yes, no, no) \
+ \
+ SC(125, 36, 34, 1, yes, no, no) \
+ SC(126, 36, 34, 2, yes, no, no) \
+ SC(127, 36, 34, 3, yes, no, no) \
+ SC(128, 36, 34, 4, yes, no, no) \
+ \
+ SC(129, 37, 35, 1, yes, no, no) \
+ SC(130, 37, 35, 2, yes, no, no) \
+ SC(131, 37, 35, 3, yes, no, no) \
+ SC(132, 37, 35, 4, yes, no, no) \
+ \
+ SC(133, 38, 36, 1, yes, no, no) \
+ SC(134, 38, 36, 2, yes, no, no) \
+ SC(135, 38, 36, 3, yes, no, no) \
+ SC(136, 38, 36, 4, yes, no, no) \
+ \
+ SC(137, 39, 37, 1, yes, no, no) \
+ SC(138, 39, 37, 2, yes, no, no) \
+ SC(139, 39, 37, 3, yes, no, no) \
+ SC(140, 39, 37, 4, yes, no, no) \
+ \
+ SC(141, 40, 38, 1, yes, no, no) \
+ SC(142, 40, 38, 2, yes, no, no) \
+ SC(143, 40, 38, 3, yes, no, no) \
+ SC(144, 40, 38, 4, yes, no, no) \
+ \
+ SC(145, 41, 39, 1, yes, no, no) \
+ SC(146, 41, 39, 2, yes, no, no) \
+ SC(147, 41, 39, 3, yes, no, no) \
+ SC(148, 41, 39, 4, yes, no, no) \
+ \
+ SC(149, 42, 40, 1, yes, no, no) \
+ SC(150, 42, 40, 2, yes, no, no) \
+ SC(151, 42, 40, 3, yes, no, no) \
+ SC(152, 42, 40, 4, yes, no, no) \
+ \
+ SC(153, 43, 41, 1, yes, no, no) \
+ SC(154, 43, 41, 2, yes, no, no) \
+ SC(155, 43, 41, 3, yes, no, no) \
+ SC(156, 43, 41, 4, yes, no, no) \
+ \
+ SC(157, 44, 42, 1, yes, no, no) \
+ SC(158, 44, 42, 2, yes, no, no) \
+ SC(159, 44, 42, 3, yes, no, no) \
+ SC(160, 44, 42, 4, yes, no, no) \
+ \
+ SC(161, 45, 43, 1, yes, no, no) \
+ SC(162, 45, 43, 2, yes, no, no) \
+ SC(163, 45, 43, 3, yes, no, no) \
+ SC(164, 45, 43, 4, yes, no, no) \
+ \
+ SC(165, 46, 44, 1, yes, no, no) \
+ SC(166, 46, 44, 2, yes, no, no) \
+ SC(167, 46, 44, 3, yes, no, no) \
+ SC(168, 46, 44, 4, yes, no, no) \
+ \
+ SC(169, 47, 45, 1, yes, no, no) \
+ SC(170, 47, 45, 2, yes, no, no) \
+ SC(171, 47, 45, 3, yes, no, no) \
+ SC(172, 47, 45, 4, yes, no, no) \
+ \
+ SC(173, 48, 46, 1, yes, no, no) \
+ SC(174, 48, 46, 2, yes, no, no) \
+ SC(175, 48, 46, 3, yes, no, no) \
+ SC(176, 48, 46, 4, yes, no, no) \
+ \
+ SC(177, 49, 47, 1, yes, no, no) \
+ SC(178, 49, 47, 2, yes, no, no) \
+ SC(179, 49, 47, 3, yes, no, no) \
+ SC(180, 49, 47, 4, yes, no, no) \
+ \
+ SC(181, 50, 48, 1, yes, no, no) \
+ SC(182, 50, 48, 2, yes, no, no) \
+ SC(183, 50, 48, 3, yes, no, no) \
+ SC(184, 50, 48, 4, yes, no, no) \
+ \
+ SC(185, 51, 49, 1, yes, no, no) \
+ SC(186, 51, 49, 2, yes, no, no) \
+ SC(187, 51, 49, 3, yes, no, no) \
+ SC(188, 51, 49, 4, yes, no, no) \
+ \
+ SC(189, 52, 50, 1, yes, no, no) \
+ SC(190, 52, 50, 2, yes, no, no) \
+ SC(191, 52, 50, 3, yes, no, no) \
+ SC(192, 52, 50, 4, yes, no, no) \
+ \
+ SC(193, 53, 51, 1, yes, no, no) \
+ SC(194, 53, 51, 2, yes, no, no) \
+ SC(195, 53, 51, 3, yes, no, no) \
+ SC(196, 53, 51, 4, yes, no, no) \
+ \
+ SC(197, 54, 52, 1, yes, no, no) \
+ SC(198, 54, 52, 2, yes, no, no) \
+ SC(199, 54, 52, 3, yes, no, no) \
+ SC(200, 54, 52, 4, yes, no, no) \
+ \
+ SC(201, 55, 53, 1, yes, no, no) \
+ SC(202, 55, 53, 2, yes, no, no) \
+ SC(203, 55, 53, 3, yes, no, no) \
+ SC(204, 55, 53, 4, yes, no, no) \
+ \
+ SC(205, 56, 54, 1, yes, no, no) \
+ SC(206, 56, 54, 2, yes, no, no) \
+ SC(207, 56, 54, 3, yes, no, no) \
+ SC(208, 56, 54, 4, yes, no, no) \
+ \
+ SC(209, 57, 55, 1, yes, no, no) \
+ SC(210, 57, 55, 2, yes, no, no) \
+ SC(211, 57, 55, 3, yes, no, no) \
+ SC(212, 57, 55, 4, yes, no, no) \
+ \
+ SC(213, 58, 56, 1, yes, no, no) \
+ SC(214, 58, 56, 2, yes, no, no) \
+ SC(215, 58, 56, 3, yes, no, no) \
+ SC(216, 58, 56, 4, yes, no, no) \
+ \
+ SC(217, 59, 57, 1, yes, no, no) \
+ SC(218, 59, 57, 2, yes, no, no) \
+ SC(219, 59, 57, 3, yes, no, no) \
+ SC(220, 59, 57, 4, yes, no, no) \
+ \
+ SC(221, 60, 58, 1, yes, no, no) \
+ SC(222, 60, 58, 2, yes, no, no) \
+ SC(223, 60, 58, 3, yes, no, no) \
+ SC(224, 60, 58, 4, yes, no, no) \
+ \
+ SC(225, 61, 59, 1, yes, no, no) \
+ SC(226, 61, 59, 2, yes, no, no) \
+ SC(227, 61, 59, 3, yes, no, no) \
+ SC(228, 61, 59, 4, yes, no, no) \
+ \
+ SC(229, 62, 60, 1, yes, no, no) \
+ SC(230, 62, 60, 2, yes, no, no) \
+ SC(231, 62, 60, 3, yes, no, no) \
+
+#define SIZE_CLASSES_DEFINED
+#define NTBINS 1
+#define NLBINS 29
+#define NBINS 36
+#define NSIZES 232
+#define NPSIZES 199
+#define LG_TINY_MAXCLASS 3
+#define LOOKUP_MAXCLASS ((((size_t)1) << 11) + (((size_t)4) << 9))
+#define SMALL_MAXCLASS ((((size_t)1) << 13) + (((size_t)3) << 11))
+#define LG_LARGE_MINCLASS 14
+#define HUGE_MAXCLASS ((((size_t)1) << 62) + (((size_t)3) << 60))
+#endif
+
+#if (LG_SIZEOF_PTR == 3 && LG_TINY_MIN == 4 && LG_QUANTUM == 4 && LG_PAGE == 12)
+#define SIZE_CLASSES \
+ /* index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup */ \
+ SC( 0, 4, 4, 0, no, yes, 4) \
+ SC( 1, 4, 4, 1, no, yes, 4) \
+ SC( 2, 4, 4, 2, no, yes, 4) \
+ SC( 3, 4, 4, 3, no, yes, 4) \
+ \
+ SC( 4, 6, 4, 1, no, yes, 4) \
+ SC( 5, 6, 4, 2, no, yes, 4) \
+ SC( 6, 6, 4, 3, no, yes, 4) \
+ SC( 7, 6, 4, 4, no, yes, 4) \
+ \
+ SC( 8, 7, 5, 1, no, yes, 5) \
+ SC( 9, 7, 5, 2, no, yes, 5) \
+ SC( 10, 7, 5, 3, no, yes, 5) \
+ SC( 11, 7, 5, 4, no, yes, 5) \
+ \
+ SC( 12, 8, 6, 1, no, yes, 6) \
+ SC( 13, 8, 6, 2, no, yes, 6) \
+ SC( 14, 8, 6, 3, no, yes, 6) \
+ SC( 15, 8, 6, 4, no, yes, 6) \
+ \
+ SC( 16, 9, 7, 1, no, yes, 7) \
+ SC( 17, 9, 7, 2, no, yes, 7) \
+ SC( 18, 9, 7, 3, no, yes, 7) \
+ SC( 19, 9, 7, 4, no, yes, 7) \
+ \
+ SC( 20, 10, 8, 1, no, yes, 8) \
+ SC( 21, 10, 8, 2, no, yes, 8) \
+ SC( 22, 10, 8, 3, no, yes, 8) \
+ SC( 23, 10, 8, 4, no, yes, 8) \
+ \
+ SC( 24, 11, 9, 1, no, yes, 9) \
+ SC( 25, 11, 9, 2, no, yes, 9) \
+ SC( 26, 11, 9, 3, no, yes, 9) \
+ SC( 27, 11, 9, 4, yes, yes, 9) \
+ \
+ SC( 28, 12, 10, 1, no, yes, no) \
+ SC( 29, 12, 10, 2, no, yes, no) \
+ SC( 30, 12, 10, 3, no, yes, no) \
+ SC( 31, 12, 10, 4, yes, yes, no) \
+ \
+ SC( 32, 13, 11, 1, no, yes, no) \
+ SC( 33, 13, 11, 2, yes, yes, no) \
+ SC( 34, 13, 11, 3, no, yes, no) \
+ SC( 35, 13, 11, 4, yes, no, no) \
+ \
+ SC( 36, 14, 12, 1, yes, no, no) \
+ SC( 37, 14, 12, 2, yes, no, no) \
+ SC( 38, 14, 12, 3, yes, no, no) \
+ SC( 39, 14, 12, 4, yes, no, no) \
+ \
+ SC( 40, 15, 13, 1, yes, no, no) \
+ SC( 41, 15, 13, 2, yes, no, no) \
+ SC( 42, 15, 13, 3, yes, no, no) \
+ SC( 43, 15, 13, 4, yes, no, no) \
+ \
+ SC( 44, 16, 14, 1, yes, no, no) \
+ SC( 45, 16, 14, 2, yes, no, no) \
+ SC( 46, 16, 14, 3, yes, no, no) \
+ SC( 47, 16, 14, 4, yes, no, no) \
+ \
+ SC( 48, 17, 15, 1, yes, no, no) \
+ SC( 49, 17, 15, 2, yes, no, no) \
+ SC( 50, 17, 15, 3, yes, no, no) \
+ SC( 51, 17, 15, 4, yes, no, no) \
+ \
+ SC( 52, 18, 16, 1, yes, no, no) \
+ SC( 53, 18, 16, 2, yes, no, no) \
+ SC( 54, 18, 16, 3, yes, no, no) \
+ SC( 55, 18, 16, 4, yes, no, no) \
+ \
+ SC( 56, 19, 17, 1, yes, no, no) \
+ SC( 57, 19, 17, 2, yes, no, no) \
+ SC( 58, 19, 17, 3, yes, no, no) \
+ SC( 59, 19, 17, 4, yes, no, no) \
+ \
+ SC( 60, 20, 18, 1, yes, no, no) \
+ SC( 61, 20, 18, 2, yes, no, no) \
+ SC( 62, 20, 18, 3, yes, no, no) \
+ SC( 63, 20, 18, 4, yes, no, no) \
+ \
+ SC( 64, 21, 19, 1, yes, no, no) \
+ SC( 65, 21, 19, 2, yes, no, no) \
+ SC( 66, 21, 19, 3, yes, no, no) \
+ SC( 67, 21, 19, 4, yes, no, no) \
+ \
+ SC( 68, 22, 20, 1, yes, no, no) \
+ SC( 69, 22, 20, 2, yes, no, no) \
+ SC( 70, 22, 20, 3, yes, no, no) \
+ SC( 71, 22, 20, 4, yes, no, no) \
+ \
+ SC( 72, 23, 21, 1, yes, no, no) \
+ SC( 73, 23, 21, 2, yes, no, no) \
+ SC( 74, 23, 21, 3, yes, no, no) \
+ SC( 75, 23, 21, 4, yes, no, no) \
+ \
+ SC( 76, 24, 22, 1, yes, no, no) \
+ SC( 77, 24, 22, 2, yes, no, no) \
+ SC( 78, 24, 22, 3, yes, no, no) \
+ SC( 79, 24, 22, 4, yes, no, no) \
+ \
+ SC( 80, 25, 23, 1, yes, no, no) \
+ SC( 81, 25, 23, 2, yes, no, no) \
+ SC( 82, 25, 23, 3, yes, no, no) \
+ SC( 83, 25, 23, 4, yes, no, no) \
+ \
+ SC( 84, 26, 24, 1, yes, no, no) \
+ SC( 85, 26, 24, 2, yes, no, no) \
+ SC( 86, 26, 24, 3, yes, no, no) \
+ SC( 87, 26, 24, 4, yes, no, no) \
+ \
+ SC( 88, 27, 25, 1, yes, no, no) \
+ SC( 89, 27, 25, 2, yes, no, no) \
+ SC( 90, 27, 25, 3, yes, no, no) \
+ SC( 91, 27, 25, 4, yes, no, no) \
+ \
+ SC( 92, 28, 26, 1, yes, no, no) \
+ SC( 93, 28, 26, 2, yes, no, no) \
+ SC( 94, 28, 26, 3, yes, no, no) \
+ SC( 95, 28, 26, 4, yes, no, no) \
+ \
+ SC( 96, 29, 27, 1, yes, no, no) \
+ SC( 97, 29, 27, 2, yes, no, no) \
+ SC( 98, 29, 27, 3, yes, no, no) \
+ SC( 99, 29, 27, 4, yes, no, no) \
+ \
+ SC(100, 30, 28, 1, yes, no, no) \
+ SC(101, 30, 28, 2, yes, no, no) \
+ SC(102, 30, 28, 3, yes, no, no) \
+ SC(103, 30, 28, 4, yes, no, no) \
+ \
+ SC(104, 31, 29, 1, yes, no, no) \
+ SC(105, 31, 29, 2, yes, no, no) \
+ SC(106, 31, 29, 3, yes, no, no) \
+ SC(107, 31, 29, 4, yes, no, no) \
+ \
+ SC(108, 32, 30, 1, yes, no, no) \
+ SC(109, 32, 30, 2, yes, no, no) \
+ SC(110, 32, 30, 3, yes, no, no) \
+ SC(111, 32, 30, 4, yes, no, no) \
+ \
+ SC(112, 33, 31, 1, yes, no, no) \
+ SC(113, 33, 31, 2, yes, no, no) \
+ SC(114, 33, 31, 3, yes, no, no) \
+ SC(115, 33, 31, 4, yes, no, no) \
+ \
+ SC(116, 34, 32, 1, yes, no, no) \
+ SC(117, 34, 32, 2, yes, no, no) \
+ SC(118, 34, 32, 3, yes, no, no) \
+ SC(119, 34, 32, 4, yes, no, no) \
+ \
+ SC(120, 35, 33, 1, yes, no, no) \
+ SC(121, 35, 33, 2, yes, no, no) \
+ SC(122, 35, 33, 3, yes, no, no) \
+ SC(123, 35, 33, 4, yes, no, no) \
+ \
+ SC(124, 36, 34, 1, yes, no, no) \
+ SC(125, 36, 34, 2, yes, no, no) \
+ SC(126, 36, 34, 3, yes, no, no) \
+ SC(127, 36, 34, 4, yes, no, no) \
+ \
+ SC(128, 37, 35, 1, yes, no, no) \
+ SC(129, 37, 35, 2, yes, no, no) \
+ SC(130, 37, 35, 3, yes, no, no) \
+ SC(131, 37, 35, 4, yes, no, no) \
+ \
+ SC(132, 38, 36, 1, yes, no, no) \
+ SC(133, 38, 36, 2, yes, no, no) \
+ SC(134, 38, 36, 3, yes, no, no) \
+ SC(135, 38, 36, 4, yes, no, no) \
+ \
+ SC(136, 39, 37, 1, yes, no, no) \
+ SC(137, 39, 37, 2, yes, no, no) \
+ SC(138, 39, 37, 3, yes, no, no) \
+ SC(139, 39, 37, 4, yes, no, no) \
+ \
+ SC(140, 40, 38, 1, yes, no, no) \
+ SC(141, 40, 38, 2, yes, no, no) \
+ SC(142, 40, 38, 3, yes, no, no) \
+ SC(143, 40, 38, 4, yes, no, no) \
+ \
+ SC(144, 41, 39, 1, yes, no, no) \
+ SC(145, 41, 39, 2, yes, no, no) \
+ SC(146, 41, 39, 3, yes, no, no) \
+ SC(147, 41, 39, 4, yes, no, no) \
+ \
+ SC(148, 42, 40, 1, yes, no, no) \
+ SC(149, 42, 40, 2, yes, no, no) \
+ SC(150, 42, 40, 3, yes, no, no) \
+ SC(151, 42, 40, 4, yes, no, no) \
+ \
+ SC(152, 43, 41, 1, yes, no, no) \
+ SC(153, 43, 41, 2, yes, no, no) \
+ SC(154, 43, 41, 3, yes, no, no) \
+ SC(155, 43, 41, 4, yes, no, no) \
+ \
+ SC(156, 44, 42, 1, yes, no, no) \
+ SC(157, 44, 42, 2, yes, no, no) \
+ SC(158, 44, 42, 3, yes, no, no) \
+ SC(159, 44, 42, 4, yes, no, no) \
+ \
+ SC(160, 45, 43, 1, yes, no, no) \
+ SC(161, 45, 43, 2, yes, no, no) \
+ SC(162, 45, 43, 3, yes, no, no) \
+ SC(163, 45, 43, 4, yes, no, no) \
+ \
+ SC(164, 46, 44, 1, yes, no, no) \
+ SC(165, 46, 44, 2, yes, no, no) \
+ SC(166, 46, 44, 3, yes, no, no) \
+ SC(167, 46, 44, 4, yes, no, no) \
+ \
+ SC(168, 47, 45, 1, yes, no, no) \
+ SC(169, 47, 45, 2, yes, no, no) \
+ SC(170, 47, 45, 3, yes, no, no) \
+ SC(171, 47, 45, 4, yes, no, no) \
+ \
+ SC(172, 48, 46, 1, yes, no, no) \
+ SC(173, 48, 46, 2, yes, no, no) \
+ SC(174, 48, 46, 3, yes, no, no) \
+ SC(175, 48, 46, 4, yes, no, no) \
+ \
+ SC(176, 49, 47, 1, yes, no, no) \
+ SC(177, 49, 47, 2, yes, no, no) \
+ SC(178, 49, 47, 3, yes, no, no) \
+ SC(179, 49, 47, 4, yes, no, no) \
+ \
+ SC(180, 50, 48, 1, yes, no, no) \
+ SC(181, 50, 48, 2, yes, no, no) \
+ SC(182, 50, 48, 3, yes, no, no) \
+ SC(183, 50, 48, 4, yes, no, no) \
+ \
+ SC(184, 51, 49, 1, yes, no, no) \
+ SC(185, 51, 49, 2, yes, no, no) \
+ SC(186, 51, 49, 3, yes, no, no) \
+ SC(187, 51, 49, 4, yes, no, no) \
+ \
+ SC(188, 52, 50, 1, yes, no, no) \
+ SC(189, 52, 50, 2, yes, no, no) \
+ SC(190, 52, 50, 3, yes, no, no) \
+ SC(191, 52, 50, 4, yes, no, no) \
+ \
+ SC(192, 53, 51, 1, yes, no, no) \
+ SC(193, 53, 51, 2, yes, no, no) \
+ SC(194, 53, 51, 3, yes, no, no) \
+ SC(195, 53, 51, 4, yes, no, no) \
+ \
+ SC(196, 54, 52, 1, yes, no, no) \
+ SC(197, 54, 52, 2, yes, no, no) \
+ SC(198, 54, 52, 3, yes, no, no) \
+ SC(199, 54, 52, 4, yes, no, no) \
+ \
+ SC(200, 55, 53, 1, yes, no, no) \
+ SC(201, 55, 53, 2, yes, no, no) \
+ SC(202, 55, 53, 3, yes, no, no) \
+ SC(203, 55, 53, 4, yes, no, no) \
+ \
+ SC(204, 56, 54, 1, yes, no, no) \
+ SC(205, 56, 54, 2, yes, no, no) \
+ SC(206, 56, 54, 3, yes, no, no) \
+ SC(207, 56, 54, 4, yes, no, no) \
+ \
+ SC(208, 57, 55, 1, yes, no, no) \
+ SC(209, 57, 55, 2, yes, no, no) \
+ SC(210, 57, 55, 3, yes, no, no) \
+ SC(211, 57, 55, 4, yes, no, no) \
+ \
+ SC(212, 58, 56, 1, yes, no, no) \
+ SC(213, 58, 56, 2, yes, no, no) \
+ SC(214, 58, 56, 3, yes, no, no) \
+ SC(215, 58, 56, 4, yes, no, no) \
+ \
+ SC(216, 59, 57, 1, yes, no, no) \
+ SC(217, 59, 57, 2, yes, no, no) \
+ SC(218, 59, 57, 3, yes, no, no) \
+ SC(219, 59, 57, 4, yes, no, no) \
+ \
+ SC(220, 60, 58, 1, yes, no, no) \
+ SC(221, 60, 58, 2, yes, no, no) \
+ SC(222, 60, 58, 3, yes, no, no) \
+ SC(223, 60, 58, 4, yes, no, no) \
+ \
+ SC(224, 61, 59, 1, yes, no, no) \
+ SC(225, 61, 59, 2, yes, no, no) \
+ SC(226, 61, 59, 3, yes, no, no) \
+ SC(227, 61, 59, 4, yes, no, no) \
+ \
+ SC(228, 62, 60, 1, yes, no, no) \
+ SC(229, 62, 60, 2, yes, no, no) \
+ SC(230, 62, 60, 3, yes, no, no) \
+
+#define SIZE_CLASSES_DEFINED
+#define NTBINS 0
+#define NLBINS 28
+#define NBINS 35
+#define NSIZES 231
+#define NPSIZES 199
+#define LG_TINY_MAXCLASS "NA"
+#define LOOKUP_MAXCLASS ((((size_t)1) << 11) + (((size_t)4) << 9))
+#define SMALL_MAXCLASS ((((size_t)1) << 13) + (((size_t)3) << 11))
+#define LG_LARGE_MINCLASS 14
+#define HUGE_MAXCLASS ((((size_t)1) << 62) + (((size_t)3) << 60))
+#endif
+
+#ifndef SIZE_CLASSES_DEFINED
+# error "No size class definitions match configuration"
+#endif
+#undef SIZE_CLASSES_DEFINED
+/*
+ * The size2index_tab lookup table uses uint8_t to encode each bin index, so we
+ * cannot support more than 256 small size classes. Further constrain NBINS to
+ * 255 since all small size classes, plus a "not small" size class must be
+ * stored in 8 bits of arena_chunk_map_bits_t's bits field.
+ */
+#if (NBINS > 255)
+# error "Too many small size classes"
+#endif
+
+#endif /* JEMALLOC_H_TYPES */
+/******************************************************************************/
+#ifdef JEMALLOC_H_STRUCTS
+
+
+#endif /* JEMALLOC_H_STRUCTS */
+/******************************************************************************/
+#ifdef JEMALLOC_H_EXTERNS
+
+
+#endif /* JEMALLOC_H_EXTERNS */
+/******************************************************************************/
+#ifdef JEMALLOC_H_INLINES
+
+
+#endif /* JEMALLOC_H_INLINES */
+/******************************************************************************/
diff --git a/include/jemalloc/internal/tcache.h b/include/jemalloc/internal/tcache.h
index 01ba062..4d0a8ff 100644
--- a/include/jemalloc/internal/tcache.h
+++ b/include/jemalloc/internal/tcache.h
@@ -28,13 +28,25 @@
*
* This constant must be an even number.
*/
+#if defined(ANDROID_TCACHE_NSLOTS_SMALL_MAX)
+#define TCACHE_NSLOTS_SMALL_MAX ANDROID_TCACHE_NSLOTS_SMALL_MAX
+#else
#define TCACHE_NSLOTS_SMALL_MAX 200
+#endif
/* Number of cache slots for large size classes. */
+#if defined(ANDROID_TCACHE_NSLOTS_LARGE)
+#define TCACHE_NSLOTS_LARGE ANDROID_TCACHE_NSLOTS_LARGE
+#else
#define TCACHE_NSLOTS_LARGE 20
+#endif
/* (1U << opt_lg_tcache_max) is used to compute tcache_maxclass. */
+#if defined(ANDROID_LG_TCACHE_MAXCLASS_DEFAULT)
+#define LG_TCACHE_MAXCLASS_DEFAULT ANDROID_LG_TCACHE_MAXCLASS_DEFAULT
+#else
#define LG_TCACHE_MAXCLASS_DEFAULT 15
+#endif
/*
* TCACHE_GC_SWEEP is the approximate number of allocation events between
diff --git a/include/jemalloc/jemalloc.h b/include/jemalloc/jemalloc.h
new file mode 100644
index 0000000..bbd3ca5
--- /dev/null
+++ b/include/jemalloc/jemalloc.h
@@ -0,0 +1,390 @@
+#ifndef JEMALLOC_H_
+#define JEMALLOC_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Defined if __attribute__((...)) syntax is supported. */
+#define JEMALLOC_HAVE_ATTR
+
+/* Defined if alloc_size attribute is supported. */
+/* #undef JEMALLOC_HAVE_ATTR_ALLOC_SIZE */
+
+/* Defined if format(gnu_printf, ...) attribute is supported. */
+#if !defined(__clang__)
+#define JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
+#endif
+
+/* Defined if format(printf, ...) attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF
+
+/*
+ * Define overrides for non-standard allocator-related functions if they are
+ * present on the system.
+ */
+#define JEMALLOC_OVERRIDE_MEMALIGN
+#ifndef __LP64__
+#define JEMALLOC_OVERRIDE_VALLOC
+#endif
+
+/*
+ * At least Linux omits the "const" in:
+ *
+ * size_t malloc_usable_size(const void *ptr);
+ *
+ * Match the operating system's prototype.
+ */
+#define JEMALLOC_USABLE_SIZE_CONST const
+
+/*
+ * If defined, specify throw() for the public function prototypes when compiling
+ * with C++. The only justification for this is to match the prototypes that
+ * glibc defines.
+ */
+/* #undef JEMALLOC_USE_CXX_THROW */
+
+#ifdef _MSC_VER
+# ifdef _WIN64
+# define LG_SIZEOF_PTR_WIN 3
+# else
+# define LG_SIZEOF_PTR_WIN 2
+# endif
+#endif
+
+/* sizeof(void *) == 2^LG_SIZEOF_PTR. */
+#ifdef __LP64__
+#define LG_SIZEOF_PTR 3
+#else
+#define LG_SIZEOF_PTR 2
+#endif
+
+/*
+ * Name mangling for public symbols is controlled by --with-mangling and
+ * --with-jemalloc-prefix. With default settings the je_ prefix is stripped by
+ * these macro definitions.
+ */
+#ifndef JEMALLOC_NO_RENAME
+# define je_malloc_conf je_malloc_conf
+# define je_malloc_message je_malloc_message
+# define je_malloc je_malloc
+# define je_calloc je_calloc
+# define je_posix_memalign je_posix_memalign
+# define je_aligned_alloc je_aligned_alloc
+# define je_realloc je_realloc
+# define je_free je_free
+# define je_mallocx je_mallocx
+# define je_rallocx je_rallocx
+# define je_xallocx je_xallocx
+# define je_sallocx je_sallocx
+# define je_dallocx je_dallocx
+# define je_sdallocx je_sdallocx
+# define je_nallocx je_nallocx
+# define je_mallctl je_mallctl
+# define je_mallctlnametomib je_mallctlnametomib
+# define je_mallctlbymib je_mallctlbymib
+# define je_malloc_stats_print je_malloc_stats_print
+# define je_malloc_usable_size je_malloc_usable_size
+# define je_memalign je_memalign
+# define je_valloc je_valloc
+#endif
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <limits.h>
+#include <strings.h>
+
+#define JEMALLOC_VERSION "4.4.0-0-gf1f76357313e7dcad7262f17a48ff0a2e005fcdc"
+#define JEMALLOC_VERSION_MAJOR 4
+#define JEMALLOC_VERSION_MINOR 4
+#define JEMALLOC_VERSION_BUGFIX 0
+#define JEMALLOC_VERSION_NREV 0
+#define JEMALLOC_VERSION_GID "f1f76357313e7dcad7262f17a48ff0a2e005fcdc"
+
+# define MALLOCX_LG_ALIGN(la) ((int)(la))
+# if LG_SIZEOF_PTR == 2
+# define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1))
+# else
+# define MALLOCX_ALIGN(a) \
+ ((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \
+ ffs((int)(((size_t)(a))>>32))+31))
+# endif
+# define MALLOCX_ZERO ((int)0x40)
+/*
+ * Bias tcache index bits so that 0 encodes "automatic tcache management", and 1
+ * encodes MALLOCX_TCACHE_NONE.
+ */
+# define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8))
+# define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1)
+/*
+ * Bias arena index bits so that 0 encodes "use an automatically chosen arena".
+ */
+# define MALLOCX_ARENA(a) ((((int)(a))+1) << 20)
+
+#if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW)
+# define JEMALLOC_CXX_THROW throw()
+#else
+# define JEMALLOC_CXX_THROW
+#endif
+
+#if _MSC_VER
+# define JEMALLOC_ATTR(s)
+# define JEMALLOC_ALIGNED(s) __declspec(align(s))
+# define JEMALLOC_ALLOC_SIZE(s)
+# define JEMALLOC_ALLOC_SIZE2(s1, s2)
+# ifndef JEMALLOC_EXPORT
+# ifdef DLLEXPORT
+# define JEMALLOC_EXPORT __declspec(dllexport)
+# else
+# define JEMALLOC_EXPORT __declspec(dllimport)
+# endif
+# endif
+# define JEMALLOC_FORMAT_PRINTF(s, i)
+# define JEMALLOC_NOINLINE __declspec(noinline)
+# ifdef __cplusplus
+# define JEMALLOC_NOTHROW __declspec(nothrow)
+# else
+# define JEMALLOC_NOTHROW
+# endif
+# define JEMALLOC_SECTION(s) __declspec(allocate(s))
+# define JEMALLOC_RESTRICT_RETURN __declspec(restrict)
+# if _MSC_VER >= 1900 && !defined(__EDG__)
+# define JEMALLOC_ALLOCATOR __declspec(allocator)
+# else
+# define JEMALLOC_ALLOCATOR
+# endif
+#elif defined(JEMALLOC_HAVE_ATTR)
+# define JEMALLOC_ATTR(s) __attribute__((s))
+# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
+# ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE
+# define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s))
+# define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2))
+# else
+# define JEMALLOC_ALLOC_SIZE(s)
+# define JEMALLOC_ALLOC_SIZE2(s1, s2)
+# endif
+# ifndef JEMALLOC_EXPORT
+# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
+# endif
+# ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
+# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i))
+# elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF)
+# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(printf, s, i))
+# else
+# define JEMALLOC_FORMAT_PRINTF(s, i)
+# endif
+# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
+# define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow)
+# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
+# define JEMALLOC_RESTRICT_RETURN
+# define JEMALLOC_ALLOCATOR
+#else
+# define JEMALLOC_ATTR(s)
+# define JEMALLOC_ALIGNED(s)
+# define JEMALLOC_ALLOC_SIZE(s)
+# define JEMALLOC_ALLOC_SIZE2(s1, s2)
+# define JEMALLOC_EXPORT
+# define JEMALLOC_FORMAT_PRINTF(s, i)
+# define JEMALLOC_NOINLINE
+# define JEMALLOC_NOTHROW
+# define JEMALLOC_SECTION(s)
+# define JEMALLOC_RESTRICT_RETURN
+# define JEMALLOC_ALLOCATOR
+#endif
+
+/*
+ * The je_ prefix on the following public symbol declarations is an artifact
+ * of namespace management, and should be omitted in application code unless
+ * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle.h).
+ */
+extern JEMALLOC_EXPORT const char *je_malloc_conf;
+extern JEMALLOC_EXPORT void (*je_malloc_message)(void *cbopaque,
+ const char *s);
+
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_malloc(size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_calloc(size_t num, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE2(1, 2);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_posix_memalign(void **memptr,
+ size_t alignment, size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(nonnull(1));
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_aligned_alloc(size_t alignment,
+ size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc)
+ JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_realloc(void *ptr, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_free(void *ptr)
+ JEMALLOC_CXX_THROW;
+
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_mallocx(size_t size, int flags)
+ JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_rallocx(void *ptr, size_t size,
+ int flags) JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_xallocx(void *ptr, size_t size,
+ size_t extra, int flags);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_sallocx(const void *ptr,
+ int flags) JEMALLOC_ATTR(pure);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_dallocx(void *ptr, int flags);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_sdallocx(void *ptr, size_t size,
+ int flags);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_nallocx(size_t size, int flags)
+ JEMALLOC_ATTR(pure);
+
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_mallctl(const char *name,
+ void *oldp, size_t *oldlenp, void *newp, size_t newlen);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_mallctlnametomib(const char *name,
+ size_t *mibp, size_t *miblenp);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_mallctlbymib(const size_t *mib,
+ size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_malloc_stats_print(
+ void (*write_cb)(void *, const char *), void *je_cbopaque,
+ const char *opts);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_malloc_usable_size(
+ JEMALLOC_USABLE_SIZE_CONST void *ptr) JEMALLOC_CXX_THROW;
+
+#ifdef JEMALLOC_OVERRIDE_MEMALIGN
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_memalign(size_t alignment, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc);
+#endif
+
+#ifdef JEMALLOC_OVERRIDE_VALLOC
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_valloc(size_t size) JEMALLOC_CXX_THROW
+ JEMALLOC_ATTR(malloc);
+#endif
+
+/*
+ * void *
+ * chunk_alloc(void *new_addr, size_t size, size_t alignment, bool *zero,
+ * bool *commit, unsigned arena_ind);
+ */
+typedef void *(chunk_alloc_t)(void *, size_t, size_t, bool *, bool *, unsigned);
+
+/*
+ * bool
+ * chunk_dalloc(void *chunk, size_t size, bool committed, unsigned arena_ind);
+ */
+typedef bool (chunk_dalloc_t)(void *, size_t, bool, unsigned);
+
+/*
+ * bool
+ * chunk_commit(void *chunk, size_t size, size_t offset, size_t length,
+ * unsigned arena_ind);
+ */
+typedef bool (chunk_commit_t)(void *, size_t, size_t, size_t, unsigned);
+
+/*
+ * bool
+ * chunk_decommit(void *chunk, size_t size, size_t offset, size_t length,
+ * unsigned arena_ind);
+ */
+typedef bool (chunk_decommit_t)(void *, size_t, size_t, size_t, unsigned);
+
+/*
+ * bool
+ * chunk_purge(void *chunk, size_t size, size_t offset, size_t length,
+ * unsigned arena_ind);
+ */
+typedef bool (chunk_purge_t)(void *, size_t, size_t, size_t, unsigned);
+
+/*
+ * bool
+ * chunk_split(void *chunk, size_t size, size_t size_a, size_t size_b,
+ * bool committed, unsigned arena_ind);
+ */
+typedef bool (chunk_split_t)(void *, size_t, size_t, size_t, bool, unsigned);
+
+/*
+ * bool
+ * chunk_merge(void *chunk_a, size_t size_a, void *chunk_b, size_t size_b,
+ * bool committed, unsigned arena_ind);
+ */
+typedef bool (chunk_merge_t)(void *, size_t, void *, size_t, bool, unsigned);
+
+typedef struct {
+ chunk_alloc_t *alloc;
+ chunk_dalloc_t *dalloc;
+ chunk_commit_t *commit;
+ chunk_decommit_t *decommit;
+ chunk_purge_t *purge;
+ chunk_split_t *split;
+ chunk_merge_t *merge;
+} chunk_hooks_t;
+
+/*
+ * By default application code must explicitly refer to mangled symbol names,
+ * so that it is possible to use jemalloc in conjunction with another allocator
+ * in the same application. Define JEMALLOC_MANGLE in order to cause automatic
+ * name mangling that matches the API prefixing that happened as a result of
+ * --with-mangling and/or --with-jemalloc-prefix configuration settings.
+ */
+#ifdef JEMALLOC_MANGLE
+# ifndef JEMALLOC_NO_DEMANGLE
+# define JEMALLOC_NO_DEMANGLE
+# endif
+# define malloc_conf je_malloc_conf
+# define malloc_message je_malloc_message
+# define malloc je_malloc
+# define calloc je_calloc
+# define posix_memalign je_posix_memalign
+# define aligned_alloc je_aligned_alloc
+# define realloc je_realloc
+# define free je_free
+# define mallocx je_mallocx
+# define rallocx je_rallocx
+# define xallocx je_xallocx
+# define sallocx je_sallocx
+# define dallocx je_dallocx
+# define sdallocx je_sdallocx
+# define nallocx je_nallocx
+# define mallctl je_mallctl
+# define mallctlnametomib je_mallctlnametomib
+# define mallctlbymib je_mallctlbymib
+# define malloc_stats_print je_malloc_stats_print
+# define malloc_usable_size je_malloc_usable_size
+# define memalign je_memalign
+# define valloc je_valloc
+#endif
+
+/*
+ * The je_* macros can be used as stable alternative names for the
+ * public jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily
+ * meant for use in jemalloc itself, but it can be used by application code to
+ * provide isolation from the name mangling specified via --with-mangling
+ * and/or --with-jemalloc-prefix.
+ */
+#ifndef JEMALLOC_NO_DEMANGLE
+# undef je_malloc_conf
+# undef je_malloc_message
+# undef je_malloc
+# undef je_calloc
+# undef je_posix_memalign
+# undef je_aligned_alloc
+# undef je_realloc
+# undef je_free
+# undef je_mallocx
+# undef je_rallocx
+# undef je_xallocx
+# undef je_sallocx
+# undef je_dallocx
+# undef je_sdallocx
+# undef je_nallocx
+# undef je_mallctl
+# undef je_mallctlnametomib
+# undef je_mallctlbymib
+# undef je_malloc_stats_print
+# undef je_malloc_usable_size
+# undef je_memalign
+# undef je_valloc
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* JEMALLOC_H_ */
diff --git a/include/jemalloc/jemalloc_defs.h b/include/jemalloc/jemalloc_defs.h
new file mode 100644
index 0000000..0fb1170
--- /dev/null
+++ b/include/jemalloc/jemalloc_defs.h
@@ -0,0 +1,52 @@
+/* include/jemalloc/jemalloc_defs.h. Generated from jemalloc_defs.h.in by configure. */
+/* Defined if __attribute__((...)) syntax is supported. */
+#define JEMALLOC_HAVE_ATTR
+
+/* Defined if alloc_size attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_ALLOC_SIZE
+
+/* Defined if format(gnu_printf, ...) attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
+
+/* Defined if format(printf, ...) attribute is supported. */
+#define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF
+
+/*
+ * Define overrides for non-standard allocator-related functions if they are
+ * present on the system.
+ */
+#define JEMALLOC_OVERRIDE_MEMALIGN
+#ifndef __LP64__
+#define JEMALLOC_OVERRIDE_VALLOC
+#endif
+
+/*
+ * At least Linux omits the "const" in:
+ *
+ * size_t malloc_usable_size(const void *ptr);
+ *
+ * Match the operating system's prototype.
+ */
+#define JEMALLOC_USABLE_SIZE_CONST const
+
+/*
+ * If defined, specify throw() for the public function prototypes when compiling
+ * with C++. The only justification for this is to match the prototypes that
+ * glibc defines.
+ */
+/* #undef JEMALLOC_USE_CXX_THROW */
+
+#ifdef _MSC_VER
+# ifdef _WIN64
+# define LG_SIZEOF_PTR_WIN 3
+# else
+# define LG_SIZEOF_PTR_WIN 2
+# endif
+#endif
+
+/* sizeof(void *) == 2^LG_SIZEOF_PTR. */
+#ifdef __LP64__
+#define LG_SIZEOF_PTR 3
+#else
+#define LG_SIZEOF_PTR 2
+#endif
diff --git a/include/jemalloc/jemalloc_macros.h b/include/jemalloc/jemalloc_macros.h
new file mode 100644
index 0000000..de9f164
--- /dev/null
+++ b/include/jemalloc/jemalloc_macros.h
@@ -0,0 +1,103 @@
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <limits.h>
+#include <strings.h>
+
+#define JEMALLOC_VERSION "4.4.0-0-gf1f76357313e7dcad7262f17a48ff0a2e005fcdc"
+#define JEMALLOC_VERSION_MAJOR 4
+#define JEMALLOC_VERSION_MINOR 4
+#define JEMALLOC_VERSION_BUGFIX 0
+#define JEMALLOC_VERSION_NREV 0
+#define JEMALLOC_VERSION_GID "f1f76357313e7dcad7262f17a48ff0a2e005fcdc"
+
+# define MALLOCX_LG_ALIGN(la) ((int)(la))
+# if LG_SIZEOF_PTR == 2
+# define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1))
+# else
+# define MALLOCX_ALIGN(a) \
+ ((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \
+ ffs((int)(((size_t)(a))>>32))+31))
+# endif
+# define MALLOCX_ZERO ((int)0x40)
+/*
+ * Bias tcache index bits so that 0 encodes "automatic tcache management", and 1
+ * encodes MALLOCX_TCACHE_NONE.
+ */
+# define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8))
+# define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1)
+/*
+ * Bias arena index bits so that 0 encodes "use an automatically chosen arena".
+ */
+# define MALLOCX_ARENA(a) ((((int)(a))+1) << 20)
+
+#if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW)
+# define JEMALLOC_CXX_THROW throw()
+#else
+# define JEMALLOC_CXX_THROW
+#endif
+
+#if _MSC_VER
+# define JEMALLOC_ATTR(s)
+# define JEMALLOC_ALIGNED(s) __declspec(align(s))
+# define JEMALLOC_ALLOC_SIZE(s)
+# define JEMALLOC_ALLOC_SIZE2(s1, s2)
+# ifndef JEMALLOC_EXPORT
+# ifdef DLLEXPORT
+# define JEMALLOC_EXPORT __declspec(dllexport)
+# else
+# define JEMALLOC_EXPORT __declspec(dllimport)
+# endif
+# endif
+# define JEMALLOC_FORMAT_PRINTF(s, i)
+# define JEMALLOC_NOINLINE __declspec(noinline)
+# ifdef __cplusplus
+# define JEMALLOC_NOTHROW __declspec(nothrow)
+# else
+# define JEMALLOC_NOTHROW
+# endif
+# define JEMALLOC_SECTION(s) __declspec(allocate(s))
+# define JEMALLOC_RESTRICT_RETURN __declspec(restrict)
+# if _MSC_VER >= 1900 && !defined(__EDG__)
+# define JEMALLOC_ALLOCATOR __declspec(allocator)
+# else
+# define JEMALLOC_ALLOCATOR
+# endif
+#elif defined(JEMALLOC_HAVE_ATTR)
+# define JEMALLOC_ATTR(s) __attribute__((s))
+# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
+# ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE
+# define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s))
+# define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2))
+# else
+# define JEMALLOC_ALLOC_SIZE(s)
+# define JEMALLOC_ALLOC_SIZE2(s1, s2)
+# endif
+# ifndef JEMALLOC_EXPORT
+# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
+# endif
+# ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
+# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i))
+# elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF)
+# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(printf, s, i))
+# else
+# define JEMALLOC_FORMAT_PRINTF(s, i)
+# endif
+# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
+# define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow)
+# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
+# define JEMALLOC_RESTRICT_RETURN
+# define JEMALLOC_ALLOCATOR
+#else
+# define JEMALLOC_ATTR(s)
+# define JEMALLOC_ALIGNED(s)
+# define JEMALLOC_ALLOC_SIZE(s)
+# define JEMALLOC_ALLOC_SIZE2(s1, s2)
+# define JEMALLOC_EXPORT
+# define JEMALLOC_FORMAT_PRINTF(s, i)
+# define JEMALLOC_NOINLINE
+# define JEMALLOC_NOTHROW
+# define JEMALLOC_SECTION(s)
+# define JEMALLOC_RESTRICT_RETURN
+# define JEMALLOC_ALLOCATOR
+#endif
diff --git a/include/jemalloc/jemalloc_mangle.h b/include/jemalloc/jemalloc_mangle.h
new file mode 100644
index 0000000..34872e8
--- /dev/null
+++ b/include/jemalloc/jemalloc_mangle.h
@@ -0,0 +1,66 @@
+/*
+ * By default application code must explicitly refer to mangled symbol names,
+ * so that it is possible to use jemalloc in conjunction with another allocator
+ * in the same application. Define JEMALLOC_MANGLE in order to cause automatic
+ * name mangling that matches the API prefixing that happened as a result of
+ * --with-mangling and/or --with-jemalloc-prefix configuration settings.
+ */
+#ifdef JEMALLOC_MANGLE
+# ifndef JEMALLOC_NO_DEMANGLE
+# define JEMALLOC_NO_DEMANGLE
+# endif
+# define malloc_conf je_malloc_conf
+# define malloc_message je_malloc_message
+# define malloc je_malloc
+# define calloc je_calloc
+# define posix_memalign je_posix_memalign
+# define aligned_alloc je_aligned_alloc
+# define realloc je_realloc
+# define free je_free
+# define mallocx je_mallocx
+# define rallocx je_rallocx
+# define xallocx je_xallocx
+# define sallocx je_sallocx
+# define dallocx je_dallocx
+# define sdallocx je_sdallocx
+# define nallocx je_nallocx
+# define mallctl je_mallctl
+# define mallctlnametomib je_mallctlnametomib
+# define mallctlbymib je_mallctlbymib
+# define malloc_stats_print je_malloc_stats_print
+# define malloc_usable_size je_malloc_usable_size
+# define memalign je_memalign
+# define valloc je_valloc
+#endif
+
+/*
+ * The je_* macros can be used as stable alternative names for the
+ * public jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily
+ * meant for use in jemalloc itself, but it can be used by application code to
+ * provide isolation from the name mangling specified via --with-mangling
+ * and/or --with-jemalloc-prefix.
+ */
+#ifndef JEMALLOC_NO_DEMANGLE
+# undef je_malloc_conf
+# undef je_malloc_message
+# undef je_malloc
+# undef je_calloc
+# undef je_posix_memalign
+# undef je_aligned_alloc
+# undef je_realloc
+# undef je_free
+# undef je_mallocx
+# undef je_rallocx
+# undef je_xallocx
+# undef je_sallocx
+# undef je_dallocx
+# undef je_sdallocx
+# undef je_nallocx
+# undef je_mallctl
+# undef je_mallctlnametomib
+# undef je_mallctlbymib
+# undef je_malloc_stats_print
+# undef je_malloc_usable_size
+# undef je_memalign
+# undef je_valloc
+#endif
diff --git a/include/jemalloc/jemalloc_mangle_jet.h b/include/jemalloc/jemalloc_mangle_jet.h
new file mode 100644
index 0000000..db5b7b0
--- /dev/null
+++ b/include/jemalloc/jemalloc_mangle_jet.h
@@ -0,0 +1,66 @@
+/*
+ * By default application code must explicitly refer to mangled symbol names,
+ * so that it is possible to use jemalloc in conjunction with another allocator
+ * in the same application. Define JEMALLOC_MANGLE in order to cause automatic
+ * name mangling that matches the API prefixing that happened as a result of
+ * --with-mangling and/or --with-jemalloc-prefix configuration settings.
+ */
+#ifdef JEMALLOC_MANGLE
+# ifndef JEMALLOC_NO_DEMANGLE
+# define JEMALLOC_NO_DEMANGLE
+# endif
+# define malloc_conf jet_malloc_conf
+# define malloc_message jet_malloc_message
+# define malloc jet_malloc
+# define calloc jet_calloc
+# define posix_memalign jet_posix_memalign
+# define aligned_alloc jet_aligned_alloc
+# define realloc jet_realloc
+# define free jet_free
+# define mallocx jet_mallocx
+# define rallocx jet_rallocx
+# define xallocx jet_xallocx
+# define sallocx jet_sallocx
+# define dallocx jet_dallocx
+# define sdallocx jet_sdallocx
+# define nallocx jet_nallocx
+# define mallctl jet_mallctl
+# define mallctlnametomib jet_mallctlnametomib
+# define mallctlbymib jet_mallctlbymib
+# define malloc_stats_print jet_malloc_stats_print
+# define malloc_usable_size jet_malloc_usable_size
+# define memalign jet_memalign
+# define valloc jet_valloc
+#endif
+
+/*
+ * The jet_* macros can be used as stable alternative names for the
+ * public jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily
+ * meant for use in jemalloc itself, but it can be used by application code to
+ * provide isolation from the name mangling specified via --with-mangling
+ * and/or --with-jemalloc-prefix.
+ */
+#ifndef JEMALLOC_NO_DEMANGLE
+# undef jet_malloc_conf
+# undef jet_malloc_message
+# undef jet_malloc
+# undef jet_calloc
+# undef jet_posix_memalign
+# undef jet_aligned_alloc
+# undef jet_realloc
+# undef jet_free
+# undef jet_mallocx
+# undef jet_rallocx
+# undef jet_xallocx
+# undef jet_sallocx
+# undef jet_dallocx
+# undef jet_sdallocx
+# undef jet_nallocx
+# undef jet_mallctl
+# undef jet_mallctlnametomib
+# undef jet_mallctlbymib
+# undef jet_malloc_stats_print
+# undef jet_malloc_usable_size
+# undef jet_memalign
+# undef jet_valloc
+#endif
diff --git a/include/jemalloc/jemalloc_protos.h b/include/jemalloc/jemalloc_protos.h
new file mode 100644
index 0000000..ff025e3
--- /dev/null
+++ b/include/jemalloc/jemalloc_protos.h
@@ -0,0 +1,66 @@
+/*
+ * The je_ prefix on the following public symbol declarations is an artifact
+ * of namespace management, and should be omitted in application code unless
+ * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle.h).
+ */
+extern JEMALLOC_EXPORT const char *je_malloc_conf;
+extern JEMALLOC_EXPORT void (*je_malloc_message)(void *cbopaque,
+ const char *s);
+
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_malloc(size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_calloc(size_t num, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE2(1, 2);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_posix_memalign(void **memptr,
+ size_t alignment, size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(nonnull(1));
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_aligned_alloc(size_t alignment,
+ size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc)
+ JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_realloc(void *ptr, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_free(void *ptr)
+ JEMALLOC_CXX_THROW;
+
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_mallocx(size_t size, int flags)
+ JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_rallocx(void *ptr, size_t size,
+ int flags) JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_xallocx(void *ptr, size_t size,
+ size_t extra, int flags);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_sallocx(const void *ptr,
+ int flags) JEMALLOC_ATTR(pure);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_dallocx(void *ptr, int flags);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_sdallocx(void *ptr, size_t size,
+ int flags);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_nallocx(size_t size, int flags)
+ JEMALLOC_ATTR(pure);
+
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_mallctl(const char *name,
+ void *oldp, size_t *oldlenp, void *newp, size_t newlen);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_mallctlnametomib(const char *name,
+ size_t *mibp, size_t *miblenp);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_mallctlbymib(const size_t *mib,
+ size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW je_malloc_stats_print(
+ void (*write_cb)(void *, const char *), void *je_cbopaque,
+ const char *opts);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW je_malloc_usable_size(
+ JEMALLOC_USABLE_SIZE_CONST void *ptr) JEMALLOC_CXX_THROW;
+
+#ifdef JEMALLOC_OVERRIDE_MEMALIGN
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_memalign(size_t alignment, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc);
+#endif
+
+#ifdef JEMALLOC_OVERRIDE_VALLOC
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *je_valloc(size_t size) JEMALLOC_CXX_THROW
+ JEMALLOC_ATTR(malloc);
+#endif
diff --git a/include/jemalloc/jemalloc_protos_jet.h b/include/jemalloc/jemalloc_protos_jet.h
new file mode 100644
index 0000000..f71efef
--- /dev/null
+++ b/include/jemalloc/jemalloc_protos_jet.h
@@ -0,0 +1,66 @@
+/*
+ * The jet_ prefix on the following public symbol declarations is an artifact
+ * of namespace management, and should be omitted in application code unless
+ * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle@install_suffix@.h).
+ */
+extern JEMALLOC_EXPORT const char *jet_malloc_conf;
+extern JEMALLOC_EXPORT void (*jet_malloc_message)(void *cbopaque,
+ const char *s);
+
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *jet_malloc(size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *jet_calloc(size_t num, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE2(1, 2);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW jet_posix_memalign(void **memptr,
+ size_t alignment, size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(nonnull(1));
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *jet_aligned_alloc(size_t alignment,
+ size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc)
+ JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *jet_realloc(void *ptr, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW jet_free(void *ptr)
+ JEMALLOC_CXX_THROW;
+
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *jet_mallocx(size_t size, int flags)
+ JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *jet_rallocx(void *ptr, size_t size,
+ int flags) JEMALLOC_ALLOC_SIZE(2);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW jet_xallocx(void *ptr, size_t size,
+ size_t extra, int flags);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW jet_sallocx(const void *ptr,
+ int flags) JEMALLOC_ATTR(pure);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW jet_dallocx(void *ptr, int flags);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW jet_sdallocx(void *ptr, size_t size,
+ int flags);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW jet_nallocx(size_t size, int flags)
+ JEMALLOC_ATTR(pure);
+
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW jet_mallctl(const char *name,
+ void *oldp, size_t *oldlenp, void *newp, size_t newlen);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW jet_mallctlnametomib(const char *name,
+ size_t *mibp, size_t *miblenp);
+JEMALLOC_EXPORT int JEMALLOC_NOTHROW jet_mallctlbymib(const size_t *mib,
+ size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
+JEMALLOC_EXPORT void JEMALLOC_NOTHROW jet_malloc_stats_print(
+ void (*write_cb)(void *, const char *), void *jet_cbopaque,
+ const char *opts);
+JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW jet_malloc_usable_size(
+ JEMALLOC_USABLE_SIZE_CONST void *ptr) JEMALLOC_CXX_THROW;
+
+#ifdef JEMALLOC_OVERRIDE_MEMALIGN
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *jet_memalign(size_t alignment, size_t size)
+ JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc);
+#endif
+
+#ifdef JEMALLOC_OVERRIDE_VALLOC
+JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
+ void JEMALLOC_NOTHROW *jet_valloc(size_t size) JEMALLOC_CXX_THROW
+ JEMALLOC_ATTR(malloc);
+#endif
diff --git a/include/jemalloc/jemalloc_rename.h b/include/jemalloc/jemalloc_rename.h
new file mode 100644
index 0000000..22e5320
--- /dev/null
+++ b/include/jemalloc/jemalloc_rename.h
@@ -0,0 +1,29 @@
+/*
+ * Name mangling for public symbols is controlled by --with-mangling and
+ * --with-jemalloc-prefix. With default settings the je_ prefix is stripped by
+ * these macro definitions.
+ */
+#ifndef JEMALLOC_NO_RENAME
+# define je_malloc_conf je_malloc_conf
+# define je_malloc_message je_malloc_message
+# define je_malloc je_malloc
+# define je_calloc je_calloc
+# define je_posix_memalign je_posix_memalign
+# define je_aligned_alloc je_aligned_alloc
+# define je_realloc je_realloc
+# define je_free je_free
+# define je_mallocx je_mallocx
+# define je_rallocx je_rallocx
+# define je_xallocx je_xallocx
+# define je_sallocx je_sallocx
+# define je_dallocx je_dallocx
+# define je_sdallocx je_sdallocx
+# define je_nallocx je_nallocx
+# define je_mallctl je_mallctl
+# define je_mallctlnametomib je_mallctlnametomib
+# define je_mallctlbymib je_mallctlbymib
+# define je_malloc_stats_print je_malloc_stats_print
+# define je_malloc_usable_size je_malloc_usable_size
+# define je_memalign je_memalign
+# define je_valloc je_valloc
+#endif
diff --git a/include/jemalloc/jemalloc_typedefs.h b/include/jemalloc/jemalloc_typedefs.h
new file mode 100644
index 0000000..fa7b350
--- /dev/null
+++ b/include/jemalloc/jemalloc_typedefs.h
@@ -0,0 +1,57 @@
+/*
+ * void *
+ * chunk_alloc(void *new_addr, size_t size, size_t alignment, bool *zero,
+ * bool *commit, unsigned arena_ind);
+ */
+typedef void *(chunk_alloc_t)(void *, size_t, size_t, bool *, bool *, unsigned);
+
+/*
+ * bool
+ * chunk_dalloc(void *chunk, size_t size, bool committed, unsigned arena_ind);
+ */
+typedef bool (chunk_dalloc_t)(void *, size_t, bool, unsigned);
+
+/*
+ * bool
+ * chunk_commit(void *chunk, size_t size, size_t offset, size_t length,
+ * unsigned arena_ind);
+ */
+typedef bool (chunk_commit_t)(void *, size_t, size_t, size_t, unsigned);
+
+/*
+ * bool
+ * chunk_decommit(void *chunk, size_t size, size_t offset, size_t length,
+ * unsigned arena_ind);
+ */
+typedef bool (chunk_decommit_t)(void *, size_t, size_t, size_t, unsigned);
+
+/*
+ * bool
+ * chunk_purge(void *chunk, size_t size, size_t offset, size_t length,
+ * unsigned arena_ind);
+ */
+typedef bool (chunk_purge_t)(void *, size_t, size_t, size_t, unsigned);
+
+/*
+ * bool
+ * chunk_split(void *chunk, size_t size, size_t size_a, size_t size_b,
+ * bool committed, unsigned arena_ind);
+ */
+typedef bool (chunk_split_t)(void *, size_t, size_t, size_t, bool, unsigned);
+
+/*
+ * bool
+ * chunk_merge(void *chunk_a, size_t size_a, void *chunk_b, size_t size_b,
+ * bool committed, unsigned arena_ind);
+ */
+typedef bool (chunk_merge_t)(void *, size_t, void *, size_t, bool, unsigned);
+
+typedef struct {
+ chunk_alloc_t *alloc;
+ chunk_dalloc_t *dalloc;
+ chunk_commit_t *commit;
+ chunk_decommit_t *decommit;
+ chunk_purge_t *purge;
+ chunk_split_t *split;
+ chunk_merge_t *merge;
+} chunk_hooks_t;
diff --git a/src/android_je_iterate.c b/src/android_je_iterate.c
new file mode 100644
index 0000000..7aa4099
--- /dev/null
+++ b/src/android_je_iterate.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+static pthread_mutex_t malloc_disabled_lock = PTHREAD_MUTEX_INITIALIZER;
+static bool malloc_disabled_tcache;
+
+static void je_iterate_chunk(arena_chunk_t *chunk,
+ void (*callback)(uintptr_t ptr, size_t size, void* arg), void* arg);
+static void je_iterate_small(arena_run_t *run,
+ void (*callback)(uintptr_t ptr, size_t size, void* arg), void* arg);
+
+/* je_iterate calls callback for each allocation found in the memory region
+ * between [base, base+size). base will be rounded down to by the jemalloc
+ * chunk size, and base+size will be rounded up to the chunk size. If no memory
+ * managed by jemalloc is found in the requested region, je_iterate returns -1
+ * and sets errno to EINVAL.
+ *
+ * je_iterate must be called when no allocations are in progress, either
+ * when single-threaded (for example just after a fork), or between
+ * jemalloc_prefork() and jemalloc_postfork_parent(). The callback must
+ * not attempt to allocate with jemalloc.
+ */
+int je_iterate(uintptr_t base, size_t size,
+ void (*callback)(uintptr_t ptr, size_t size, void* arg), void* arg) {
+
+ int error = EINVAL;
+ uintptr_t ptr = (uintptr_t)CHUNK_ADDR2BASE(base);
+ uintptr_t end = CHUNK_CEILING(base + size);
+
+ while (ptr < end) {
+ assert(ptr == (uintptr_t)CHUNK_ADDR2BASE(ptr));
+ extent_node_t *node;
+
+ node = chunk_lookup((void *)ptr, false);
+ if (node == NULL) {
+ ptr += chunksize;
+ continue;
+ }
+
+ assert(extent_node_achunk_get(node) ||
+ (uintptr_t)extent_node_addr_get(node) == ptr);
+
+ error = 0;
+ if (extent_node_achunk_get(node)) {
+ /* Chunk */
+ arena_chunk_t *chunk = (arena_chunk_t *)ptr;
+ ptr += chunksize;
+
+ if (&chunk->node != node) {
+ /* Empty retained chunk */
+ continue;
+ }
+
+ je_iterate_chunk(chunk, callback, arg);
+ } else if ((uintptr_t)extent_node_addr_get(node) == ptr) {
+ /* Huge allocation */
+ callback(ptr, extent_node_size_get(node), arg);
+ ptr = CHUNK_CEILING(ptr + extent_node_size_get(node));
+ }
+ }
+
+ if (error) {
+ set_errno(error);
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Iterate over a valid jemalloc chunk, calling callback for each large
+ * allocation run, and calling je_iterate_small for each small allocation run */
+static void je_iterate_chunk(arena_chunk_t *chunk,
+ void (*callback)(uintptr_t ptr, size_t size, void* arg), void* arg) {
+ size_t pageind;
+
+ pageind = map_bias;
+
+ while (pageind < chunk_npages) {
+ size_t mapbits;
+ size_t size;
+
+ mapbits = arena_mapbits_get(chunk, pageind);
+ if (!arena_mapbits_allocated_get(chunk, pageind)) {
+ /* Unallocated run */
+ size = arena_mapbits_unallocated_size_get(chunk, pageind);
+ } else if (arena_mapbits_large_get(chunk, pageind)) {
+ /* Large allocation run */
+ void *rpages;
+
+ size = arena_mapbits_large_size_get(chunk, pageind);
+ rpages = arena_miscelm_to_rpages(arena_miscelm_get_mutable(chunk, pageind));
+ callback((uintptr_t)rpages, size, arg);
+ } else {
+ /* Run of small allocations */
+ szind_t binind;
+ arena_run_t *run;
+
+ assert(arena_mapbits_small_runind_get(chunk, pageind) == pageind);
+ binind = arena_mapbits_binind_get(chunk, pageind);
+ run = &arena_miscelm_get_mutable(chunk, pageind)->run;
+ assert(run->binind == binind);
+ size = arena_bin_info[binind].run_size;
+
+ je_iterate_small(run, callback, arg);
+ }
+ assert(size == PAGE_CEILING(size));
+ assert(size > 0);
+ pageind += size >> LG_PAGE;
+ }
+
+}
+
+/* Iterate over a valid jemalloc small allocation run, calling callback for each
+ * active allocation. */
+static void je_iterate_small(arena_run_t *run,
+ void (*callback)(uintptr_t ptr, size_t size, void* arg), void* arg) {
+ szind_t binind;
+ const arena_bin_info_t *bin_info;
+ uint32_t regind;
+ uintptr_t ptr;
+ void *rpages;
+
+ binind = run->binind;
+ bin_info = &arena_bin_info[binind];
+ rpages = arena_miscelm_to_rpages(arena_run_to_miscelm(run));
+ ptr = (uintptr_t)rpages + bin_info->reg0_offset;
+
+ for (regind = 0; regind < bin_info->nregs; regind++) {
+ if (bitmap_get(run->bitmap, &bin_info->bitmap_info, regind)) {
+ callback(ptr, bin_info->reg_size, arg);
+ }
+ ptr += bin_info->reg_interval;
+ }
+}
+
+static void je_malloc_disable_prefork() {
+ pthread_mutex_lock(&malloc_disabled_lock);
+}
+
+static void je_malloc_disable_postfork_parent() {
+ pthread_mutex_unlock(&malloc_disabled_lock);
+}
+
+static void je_malloc_disable_postfork_child() {
+ pthread_mutex_init(&malloc_disabled_lock, NULL);
+}
+
+void je_malloc_disable_init() {
+ if (pthread_atfork(je_malloc_disable_prefork,
+ je_malloc_disable_postfork_parent, je_malloc_disable_postfork_child) != 0) {
+ malloc_write("<jemalloc>: Error in pthread_atfork()\n");
+ if (opt_abort)
+ abort();
+ }
+}
+
+void je_malloc_disable() {
+ static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+ pthread_once(&once_control, je_malloc_disable_init);
+
+ pthread_mutex_lock(&malloc_disabled_lock);
+ bool new_tcache = false;
+ size_t old_len = sizeof(malloc_disabled_tcache);
+ je_mallctl("thread.tcache.enabled",
+ &malloc_disabled_tcache, &old_len,
+ &new_tcache, sizeof(new_tcache));
+ jemalloc_prefork();
+}
+
+void je_malloc_enable() {
+ jemalloc_postfork_parent();
+ if (malloc_disabled_tcache) {
+ je_mallctl("thread.tcache.enabled", NULL, NULL,
+ &malloc_disabled_tcache, sizeof(malloc_disabled_tcache));
+ }
+ pthread_mutex_unlock(&malloc_disabled_lock);
+}
diff --git a/src/android_je_mallinfo.c b/src/android_je_mallinfo.c
new file mode 100644
index 0000000..802a3eb
--- /dev/null
+++ b/src/android_je_mallinfo.c
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* This is an implementation that uses the same arena access pattern found
+ * in the arena_stats_merge function from src/arena.c.
+ */
+struct mallinfo je_mallinfo() {
+ struct mallinfo mi;
+ memset(&mi, 0, sizeof(mi));
+
+ malloc_mutex_lock(TSDN_NULL, &arenas_lock);
+ for (unsigned i = 0; i < narenas_auto; i++) {
+ if (arenas[i] != NULL) {
+ malloc_mutex_lock(TSDN_NULL, &arenas[i]->lock);
+ mi.hblkhd += arenas[i]->stats.mapped;
+ mi.uordblks += arenas[i]->stats.allocated_large;
+ mi.uordblks += arenas[i]->stats.allocated_huge;
+ malloc_mutex_unlock(TSDN_NULL, &arenas[i]->lock);
+
+ for (unsigned j = 0; j < NBINS; j++) {
+ arena_bin_t* bin = &arenas[i]->bins[j];
+
+ malloc_mutex_lock(TSDN_NULL, &bin->lock);
+ mi.uordblks += arena_bin_info[j].reg_size * bin->stats.curregs;
+ malloc_mutex_unlock(TSDN_NULL, &bin->lock);
+ }
+ }
+ }
+ malloc_mutex_unlock(TSDN_NULL, &arenas_lock);
+ mi.fordblks = mi.hblkhd - mi.uordblks;
+ mi.usmblks = mi.hblkhd;
+ return mi;
+}
+
+size_t __mallinfo_narenas() {
+ return narenas_auto;
+}
+
+size_t __mallinfo_nbins() {
+ return NBINS;
+}
+
+struct mallinfo __mallinfo_arena_info(size_t aidx) {
+ struct mallinfo mi;
+ memset(&mi, 0, sizeof(mi));
+
+ malloc_mutex_lock(TSDN_NULL, &arenas_lock);
+ if (aidx < narenas_auto) {
+ if (arenas[aidx] != NULL) {
+ malloc_mutex_lock(TSDN_NULL, &arenas[aidx]->lock);
+ mi.hblkhd = arenas[aidx]->stats.mapped;
+ mi.ordblks = arenas[aidx]->stats.allocated_large;
+ mi.uordblks = arenas[aidx]->stats.allocated_huge;
+ malloc_mutex_unlock(TSDN_NULL, &arenas[aidx]->lock);
+
+ for (unsigned j = 0; j < NBINS; j++) {
+ arena_bin_t* bin = &arenas[aidx]->bins[j];
+
+ malloc_mutex_lock(TSDN_NULL, &bin->lock);
+ mi.fsmblks += arena_bin_info[j].reg_size * bin->stats.curregs;
+ malloc_mutex_unlock(TSDN_NULL, &bin->lock);
+ }
+ }
+ }
+ malloc_mutex_unlock(TSDN_NULL, &arenas_lock);
+ return mi;
+}
+
+struct mallinfo __mallinfo_bin_info(size_t aidx, size_t bidx) {
+ struct mallinfo mi;
+ memset(&mi, 0, sizeof(mi));
+
+ malloc_mutex_lock(TSDN_NULL, &arenas_lock);
+ if (aidx < narenas_auto && bidx < NBINS) {
+ if (arenas[aidx] != NULL) {
+ arena_bin_t* bin = &arenas[aidx]->bins[bidx];
+
+ malloc_mutex_lock(TSDN_NULL, &bin->lock);
+ mi.ordblks = arena_bin_info[bidx].reg_size * bin->stats.curregs;
+ mi.uordblks = bin->stats.nmalloc;
+ mi.fordblks = bin->stats.ndalloc;
+ malloc_mutex_unlock(TSDN_NULL, &bin->lock);
+ }
+ }
+ malloc_mutex_unlock(TSDN_NULL, &arenas_lock);
+ return mi;
+}
diff --git a/src/huge.c b/src/huge.c
index 8abd8c0..1e5cb00 100644
--- a/src/huge.c
+++ b/src/huge.c
@@ -81,8 +81,20 @@
* it is possible to make correct junk/zero fill decisions below.
*/
is_zeroed = zero;
- if (likely(!tsdn_null(tsdn)))
+ /* ANDROID change */
+ if (likely(!tsdn_null(tsdn))) {
+#if !defined(__LP64__)
+ /* On 32 bit systems, using a per arena cache can exhaust
+ * virtual address space. Force all huge allocations to
+ * always take place in the first arena.
+ */
+ extern arena_t *a0get(void);
+ arena = a0get();
+#else
arena = arena_choose(tsdn_tsd(tsdn), arena);
+#endif
+ }
+ /* End ANDROID change */
if (unlikely(arena == NULL) || (ret = arena_chunk_alloc_huge(tsdn,
arena, usize, alignment, &sn, &is_zeroed)) == NULL) {
idalloctm(tsdn, node, NULL, true, true);
diff --git a/src/jemalloc.c b/src/jemalloc.c
index baead66..11aebd9 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -963,7 +963,11 @@
opt_tcache = false;
}
+#if defined(__ANDROID__)
+ for (i = 0; i < 2; i++) {
+#else
for (i = 0; i < 4; i++) {
+#endif
/* Get runtime configuration. */
switch (i) {
case 0:
@@ -1444,6 +1448,14 @@
else
opt_narenas = 1;
}
+#if defined(ANDROID_MAX_ARENAS)
+ /* Never create more than MAX_ARENAS arenas regardless of num_cpus.
+ * Extra arenas use more PSS and are not very useful unless
+ * lots of threads are allocing/freeing at the same time.
+ */
+ if (opt_narenas > ANDROID_MAX_ARENAS)
+ opt_narenas = ANDROID_MAX_ARENAS;
+#endif
narenas_auto = opt_narenas;
/*
* Limit the number of arenas to the indexing range of MALLOCX_ARENA().
@@ -2914,3 +2926,8 @@
}
/******************************************************************************/
+
+/* ANDROID extension */
+#include "android_je_iterate.c"
+#include "android_je_mallinfo.c"
+/* End ANDROID extension */
diff --git a/src/pages.c b/src/pages.c
index 5f0c966..44f82ee 100644
--- a/src/pages.c
+++ b/src/pages.c
@@ -16,6 +16,17 @@
static bool os_overcommits;
/******************************************************************************/
+/* Defines/includes needed for special android code. */
+
+#if defined(__ANDROID__)
+#include <sys/prctl.h>
+
+/* Definitions of prctl arguments to set a vma name in Android kernels. */
+#define ANDROID_PR_SET_VMA 0x53564d41
+#define ANDROID_PR_SET_VMA_ANON_NAME 0
+#endif
+
+/******************************************************************************/
void *
pages_map(void *addr, size_t size, bool *commit)
@@ -56,6 +67,13 @@
ret = NULL;
}
#endif
+#if defined(__ANDROID__)
+ if (ret != NULL) {
+ /* Name this memory as being used by libc */
+ prctl(ANDROID_PR_SET_VMA, ANDROID_PR_SET_VMA_ANON_NAME, ret,
+ size, "libc_malloc");
+ }
+#endif
assert(ret == NULL || (addr == NULL && ret != addr)
|| (addr != NULL && ret == addr));
return (ret);
diff --git a/test/include/test/jemalloc_test.h b/test/include/test/jemalloc_test.h
new file mode 100644
index 0000000..ec3a599
--- /dev/null
+++ b/test/include/test/jemalloc_test.h
@@ -0,0 +1,163 @@
+#include <limits.h>
+#ifndef SIZE_T_MAX
+# define SIZE_T_MAX SIZE_MAX
+#endif
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <math.h>
+#include <string.h>
+#ifdef _WIN32
+# include "msvc_compat/strings.h"
+#endif
+
+#ifdef _WIN32
+# include <windows.h>
+# include "msvc_compat/windows_extra.h"
+#else
+# include <pthread.h>
+#endif
+
+#include "test/jemalloc_test_defs.h"
+
+#ifdef JEMALLOC_OSSPIN
+# include <libkern/OSAtomic.h>
+#endif
+
+#if defined(HAVE_ALTIVEC) && !defined(__APPLE__)
+# include <altivec.h>
+#endif
+#ifdef HAVE_SSE2
+# include <emmintrin.h>
+#endif
+
+/******************************************************************************/
+/*
+ * For unit tests, expose all public and private interfaces.
+ */
+#ifdef JEMALLOC_UNIT_TEST
+# define JEMALLOC_JET
+# define JEMALLOC_MANGLE
+# include "jemalloc/internal/jemalloc_internal.h"
+
+/******************************************************************************/
+/*
+ * For integration tests, expose the public jemalloc interfaces, but only
+ * expose the minimum necessary internal utility code (to avoid re-implementing
+ * essentially identical code within the test infrastructure).
+ */
+#elif defined(JEMALLOC_INTEGRATION_TEST)
+# define JEMALLOC_MANGLE
+# include "jemalloc/jemalloc.h"
+# include "jemalloc/internal/jemalloc_internal_defs.h"
+# include "jemalloc/internal/jemalloc_internal_macros.h"
+
+static const bool config_debug =
+#ifdef JEMALLOC_DEBUG
+ true
+#else
+ false
+#endif
+ ;
+
+# define JEMALLOC_N(n) je_##n
+# include "jemalloc/internal/private_namespace.h"
+
+# define JEMALLOC_H_TYPES
+# define JEMALLOC_H_STRUCTS
+# define JEMALLOC_H_EXTERNS
+# define JEMALLOC_H_INLINES
+# include "jemalloc/internal/nstime.h"
+# include "jemalloc/internal/util.h"
+# include "jemalloc/internal/qr.h"
+# include "jemalloc/internal/ql.h"
+# undef JEMALLOC_H_TYPES
+# undef JEMALLOC_H_STRUCTS
+# undef JEMALLOC_H_EXTERNS
+# undef JEMALLOC_H_INLINES
+
+/******************************************************************************/
+/*
+ * For stress tests, expose the public jemalloc interfaces with name mangling
+ * so that they can be tested as e.g. malloc() and free(). Also expose the
+ * public jemalloc interfaces with jet_ prefixes, so that stress tests can use
+ * a separate allocator for their internal data structures.
+ */
+#elif defined(JEMALLOC_STRESS_TEST)
+# include "jemalloc/jemalloc.h"
+
+# include "jemalloc/jemalloc_protos_jet.h"
+
+# define JEMALLOC_JET
+# include "jemalloc/internal/jemalloc_internal.h"
+# include "jemalloc/internal/public_unnamespace.h"
+# undef JEMALLOC_JET
+
+# include "jemalloc/jemalloc_rename.h"
+# define JEMALLOC_MANGLE
+# ifdef JEMALLOC_STRESS_TESTLIB
+# include "jemalloc/jemalloc_mangle_jet.h"
+# else
+# include "jemalloc/jemalloc_mangle.h"
+# endif
+
+/******************************************************************************/
+/*
+ * This header does dangerous things, the effects of which only test code
+ * should be subject to.
+ */
+#else
+# error "This header cannot be included outside a testing context"
+#endif
+
+/******************************************************************************/
+/*
+ * Common test utilities.
+ */
+#include "test/btalloc.h"
+#include "test/math.h"
+#include "test/mtx.h"
+#include "test/mq.h"
+#include "test/test.h"
+#include "test/timer.h"
+#include "test/thd.h"
+#define MEXP 19937
+#include "test/SFMT.h"
+
+/******************************************************************************/
+/*
+ * Define always-enabled assertion macros, so that test assertions execute even
+ * if assertions are disabled in the library code.
+ */
+#undef assert
+#undef not_reached
+#undef not_implemented
+#undef assert_not_implemented
+
+#define assert(e) do { \
+ if (!(e)) { \
+ malloc_printf( \
+ "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
+ __FILE__, __LINE__, #e); \
+ abort(); \
+ } \
+} while (0)
+
+#define not_reached() do { \
+ malloc_printf( \
+ "<jemalloc>: %s:%d: Unreachable code reached\n", \
+ __FILE__, __LINE__); \
+ abort(); \
+} while (0)
+
+#define not_implemented() do { \
+ malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
+ __FILE__, __LINE__); \
+ abort(); \
+} while (0)
+
+#define assert_not_implemented(e) do { \
+ if (!(e)) \
+ not_implemented(); \
+} while (0)
diff --git a/test/include/test/jemalloc_test_defs.h b/test/include/test/jemalloc_test_defs.h
new file mode 100644
index 0000000..3ea3a27
--- /dev/null
+++ b/test/include/test/jemalloc_test_defs.h
@@ -0,0 +1,12 @@
+/* test/include/test/jemalloc_test_defs.h. Generated from jemalloc_test_defs.h.in by configure. */
+#include "jemalloc/internal/jemalloc_internal_defs.h"
+#include "jemalloc/internal/jemalloc_internal_decls.h"
+
+/*
+ * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its
+ * dependencies are notoriously unportable in practice.
+ */
+#if defined(__x86_64__)
+#define HAVE_SSE2
+#endif
+/* #undef HAVE_ALTIVEC */
diff --git a/test/integration/iterate.c b/test/integration/iterate.c
new file mode 100644
index 0000000..5305762
--- /dev/null
+++ b/test/integration/iterate.c
@@ -0,0 +1,121 @@
+#include "test/jemalloc_test.h"
+
+/* Tests je_iterate added by src/android_je_iterate.c */
+
+int je_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
+
+static size_t alloc_count;
+static size_t alloc_size;
+static uintptr_t alloc_find;
+static size_t alloc_find_size;
+static bool alloc_found;
+
+static void callback(uintptr_t ptr, size_t size, void* arg) {
+ alloc_count++;
+ alloc_size += size;
+ if (ptr <= alloc_find && alloc_find < ptr + size) {
+ assert(alloc_find + alloc_find_size <= ptr + size);
+ alloc_found = true;
+ }
+}
+
+TEST_BEGIN(test_iterate_alloc)
+{
+
+#define MAXSZ (((size_t)1) << 26)
+ size_t sz;
+
+ for (sz = 1; sz < MAXSZ; sz <<= 1) {
+ void *ptr;
+ ptr = malloc(sz);
+ assert_ptr_not_null(ptr, "malloc() failed for size %zu", sz);
+
+ alloc_count = 0;
+ alloc_size = 0;
+ alloc_find = (uintptr_t)ptr;
+ alloc_find_size = sz;
+ alloc_found = false;
+
+ mallctl("thread.tcache.flush", NULL, NULL, NULL, 0);
+
+ assert(je_iterate((uintptr_t)ptr, sz, callback, NULL) == 0);
+
+ assert(alloc_found);
+
+ free(ptr);
+ }
+#undef MAXSZ
+}
+TEST_END
+
+TEST_BEGIN(test_iterate_dalloc)
+{
+
+#define MAXSZ (((size_t)1) << 26)
+ size_t sz;
+
+ for (sz = 1; sz < MAXSZ; sz <<= 1) {
+ void *ptr;
+ ptr = malloc(sz);
+ free(ptr);
+ assert_ptr_not_null(ptr, "malloc() failed for size %zu", sz);
+
+ alloc_count = 0;
+ alloc_size = 0;
+ alloc_find = (uintptr_t)ptr;
+ alloc_find_size = sz;
+ alloc_found = false;
+
+ mallctl("thread.tcache.flush", NULL, NULL, NULL, 0);
+
+ je_iterate((uintptr_t)ptr, sz, callback, NULL);
+
+ assert(!alloc_found);
+ }
+#undef MAXSZ
+}
+TEST_END
+
+TEST_BEGIN(test_iterate_free_first)
+{
+#define MAXSZ (((size_t)1) << 26)
+ size_t sz;
+
+ for (sz = 1; sz < MAXSZ; sz <<= 1) {
+ void *ptr;
+ void *ptr2;
+ ptr2 = malloc(sz);
+ assert_ptr_not_null(ptr2, "malloc() failed for size %zu", sz);
+
+ ptr = malloc(sz);
+ assert_ptr_not_null(ptr, "malloc() failed for size %zu", sz);
+
+ free(ptr2);
+
+ alloc_count = 0;
+ alloc_size = 0;
+ alloc_find = (uintptr_t)ptr;
+ alloc_find_size = sz;
+ alloc_found = false;
+
+ mallctl("thread.tcache.flush", NULL, NULL, NULL, 0);
+
+ assert(je_iterate((uintptr_t)ptr, sz, callback, NULL) == 0);
+
+ assert(alloc_found);
+
+ free(ptr);
+ }
+#undef MAXSZ
+}
+TEST_END
+
+int
+main(void)
+{
+
+ return (test(
+ test_iterate_alloc,
+ test_iterate_dalloc,
+ test_iterate_free_first));
+}