1 #include <stdlib.h> 2 #include <stdbool.h> 3 #include <stdint.h> 4 #include <limits.h> 5 #include <strings.h> 6 7 #define JEMALLOC_VERSION "5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8" 8 #define JEMALLOC_VERSION_MAJOR 5 9 #define JEMALLOC_VERSION_MINOR 3 10 #define JEMALLOC_VERSION_BUGFIX 1 11 #define JEMALLOC_VERSION_NREV 0 12 #define JEMALLOC_VERSION_GID "81034ce1f1373e37dc865038e1bc8eeecf559ce8" 13 #define JEMALLOC_VERSION_GID_IDENT 81034ce1f1373e37dc865038e1bc8eeecf559ce8 14 15 #define MALLOCX_LG_ALIGN(la) ((int)(la)) 16 #if LG_SIZEOF_PTR == 2 17 # define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1)) 18 #else 19 # define MALLOCX_ALIGN(a) \ 20 ((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \ 21 ffs((int)(((size_t)(a))>>32))+31)) 22 #endif 23 #define MALLOCX_ZERO ((int)0x40) 24 /* 25 * Bias tcache index bits so that 0 encodes "automatic tcache management", and 1 26 * encodes MALLOCX_TCACHE_NONE. 27 */ 28 #define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8)) 29 #define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1) 30 /* 31 * Bias arena index bits so that 0 encodes "use an automatically chosen arena". 32 */ 33 #define MALLOCX_ARENA(a) ((((int)(a))+1) << 20) 34 35 /* 36 * Use as arena index in "arena.<i>.{purge,decay,dss}" and 37 * "stats.arenas.<i>.*" mallctl interfaces to select all arenas. This 38 * definition is intentionally specified in raw decimal format to support 39 * cpp-based string concatenation, e.g. 40 * 41 * #define STRINGIFY_HELPER(x) #x 42 * #define STRINGIFY(x) STRINGIFY_HELPER(x) 43 * 44 * mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".purge", NULL, NULL, NULL, 45 * 0); 46 */ 47 #define MALLCTL_ARENAS_ALL 4096 48 /* 49 * Use as arena index in "stats.arenas.<i>.*" mallctl interfaces to select 50 * destroyed arenas. 51 */ 52 #define MALLCTL_ARENAS_DESTROYED 4097 53 54 #if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW) 55 # define JEMALLOC_CXX_THROW noexcept (true) 56 #else 57 # define JEMALLOC_CXX_THROW 58 #endif 59 60 #if defined(_MSC_VER) 61 # define JEMALLOC_ATTR(s) 62 # define JEMALLOC_ALIGNED(s) __declspec(align(s)) 63 # define JEMALLOC_ALLOC_SIZE(s) 64 # define JEMALLOC_ALLOC_SIZE2(s1, s2) 65 # ifndef JEMALLOC_EXPORT 66 # ifdef DLLEXPORT 67 # define JEMALLOC_EXPORT __declspec(dllexport) 68 # else 69 # define JEMALLOC_EXPORT __declspec(dllimport) 70 # endif 71 # endif 72 # define JEMALLOC_FORMAT_ARG(i) 73 # define JEMALLOC_FORMAT_PRINTF(s, i) 74 # define JEMALLOC_FALLTHROUGH 75 # define JEMALLOC_NOINLINE __declspec(noinline) 76 # ifdef __cplusplus 77 # define JEMALLOC_NOTHROW __declspec(nothrow) 78 # else 79 # define JEMALLOC_NOTHROW 80 # endif 81 # define JEMALLOC_SECTION(s) __declspec(allocate(s)) 82 # define JEMALLOC_RESTRICT_RETURN __declspec(restrict) 83 # if _MSC_VER >= 1900 && !defined(__EDG__) 84 # define JEMALLOC_ALLOCATOR __declspec(allocator) 85 # else 86 # define JEMALLOC_ALLOCATOR 87 # endif 88 # define JEMALLOC_COLD 89 # define JEMALLOC_WARN_ON_USAGE(warning_message) 90 #elif defined(JEMALLOC_HAVE_ATTR) 91 # define JEMALLOC_ATTR(s) __attribute__((s)) 92 # define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s)) 93 # ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE 94 # define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s)) 95 # define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2)) 96 # else 97 # define JEMALLOC_ALLOC_SIZE(s) 98 # define JEMALLOC_ALLOC_SIZE2(s1, s2) 99 # endif 100 # ifndef JEMALLOC_EXPORT 101 # define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default")) 102 # endif 103 # ifdef JEMALLOC_HAVE_ATTR_FORMAT_ARG 104 # define JEMALLOC_FORMAT_ARG(i) JEMALLOC_ATTR(__format_arg__(3)) 105 # else 106 # define JEMALLOC_FORMAT_ARG(i) 107 # endif 108 # ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF 109 # define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i)) 110 # elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF) 111 # define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(printf, s, i)) 112 # else 113 # define JEMALLOC_FORMAT_PRINTF(s, i) 114 # endif 115 # ifdef JEMALLOC_HAVE_ATTR_FALLTHROUGH 116 # define JEMALLOC_FALLTHROUGH JEMALLOC_ATTR(fallthrough) 117 # else 118 # define JEMALLOC_FALLTHROUGH 119 # endif 120 # define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline) 121 # define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow) 122 # define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s)) 123 # define JEMALLOC_RESTRICT_RETURN 124 # define JEMALLOC_ALLOCATOR 125 # ifdef JEMALLOC_HAVE_ATTR_COLD 126 # define JEMALLOC_COLD JEMALLOC_ATTR(__cold__) 127 # else 128 # define JEMALLOC_COLD 129 # endif 130 # ifdef JEMALLOC_HAVE_ATTR_DEPRECATED 131 # define JEMALLOC_WARN_ON_USAGE(warning_message) JEMALLOC_ATTR(deprecated(warning_message)) 132 # else 133 # define JEMALLOC_WARN_ON_USAGE(warning_message) 134 # endif 135 #else 136 # define JEMALLOC_ATTR(s) 137 # define JEMALLOC_ALIGNED(s) 138 # define JEMALLOC_ALLOC_SIZE(s) 139 # define JEMALLOC_ALLOC_SIZE2(s1, s2) 140 # define JEMALLOC_EXPORT 141 # define JEMALLOC_FORMAT_PRINTF(s, i) 142 # define JEMALLOC_FALLTHROUGH 143 # define JEMALLOC_NOINLINE 144 # define JEMALLOC_NOTHROW 145 # define JEMALLOC_SECTION(s) 146 # define JEMALLOC_RESTRICT_RETURN 147 # define JEMALLOC_ALLOCATOR 148 # define JEMALLOC_COLD 149 # define JEMALLOC_WARN_ON_USAGE(warning_message) 150 #endif 151 152 #if (defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__linux__) && !defined(__GLIBC__))) && !defined(JEMALLOC_NO_RENAME) 153 # define JEMALLOC_SYS_NOTHROW 154 #else 155 # define JEMALLOC_SYS_NOTHROW JEMALLOC_NOTHROW 156 #endif 157