1 /* include/jemalloc/internal/jemalloc_internal_defs.h. Generated from jemalloc_internal_defs.h.in by configure. */ 2 #ifndef JEMALLOC_INTERNAL_DEFS_H_ 3 #define JEMALLOC_INTERNAL_DEFS_H_ 4 /* 5 * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all 6 * public APIs to be prefixed. This makes it possible, with some care, to use 7 * multiple allocators simultaneously. 8 */ 9 /* #undef JEMALLOC_PREFIX */ 10 /* #undef JEMALLOC_CPREFIX */ 11 12 /* 13 * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs. 14 * For shared libraries, symbol visibility mechanisms prevent these symbols 15 * from being exported, but for static libraries, naming collisions are a real 16 * possibility. 17 */ 18 #define JEMALLOC_PRIVATE_NAMESPACE __je_ 19 20 /* 21 * Hyper-threaded CPUs may need a special instruction inside spin loops in 22 * order to yield to another virtual CPU. 23 */ 24 #define CPU_SPINWAIT __asm__ volatile("pause") 25 26 /* Defined if C11 atomics are available. */ 27 /* #undef JEMALLOC_C11ATOMICS */ 28 29 /* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */ 30 #define JEMALLOC_ATOMIC9 1 31 32 /* 33 * Defined if OSAtomic*() functions are available, as provided by Darwin, and 34 * documented in the atomic(3) manual page. 35 */ 36 /* #undef JEMALLOC_OSATOMIC */ 37 38 /* 39 * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and 40 * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite 41 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the 42 * functions are defined in libgcc instead of being inlines). 43 */ 44 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4 */ 45 46 /* 47 * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and 48 * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite 49 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the 50 * functions are defined in libgcc instead of being inlines). 51 */ 52 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8 */ 53 54 /* 55 * Defined if __builtin_clz() and __builtin_clzl() are available. 56 */ 57 #define JEMALLOC_HAVE_BUILTIN_CLZ 58 59 /* 60 * Defined if madvise(2) is available. 61 */ 62 #define JEMALLOC_HAVE_MADVISE 63 64 /* 65 * Defined if OSSpin*() functions are available, as provided by Darwin, and 66 * documented in the spinlock(3) manual page. 67 */ 68 /* #undef JEMALLOC_OSSPIN */ 69 70 /* 71 * Defined if secure_getenv(3) is available. 72 */ 73 /* #undef JEMALLOC_HAVE_SECURE_GETENV */ 74 75 /* 76 * Defined if issetugid(2) is available. 77 */ 78 #define JEMALLOC_HAVE_ISSETUGID 79 80 /* 81 * Defined if _malloc_thread_cleanup() exists. At least in the case of 82 * FreeBSD, pthread_key_create() allocates, which if used during malloc 83 * bootstrapping will cause recursion into the pthreads library. Therefore, if 84 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in 85 * malloc_tsd. 86 */ 87 #define JEMALLOC_MALLOC_THREAD_CLEANUP 88 89 /* 90 * Defined if threaded initialization is known to be safe on this platform. 91 * Among other things, it must be possible to initialize a mutex without 92 * triggering allocation in order for threaded allocation to be safe. 93 */ 94 /* #undef JEMALLOC_THREADED_INIT */ 95 96 /* 97 * Defined if the pthreads implementation defines 98 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order 99 * to avoid recursive allocation during mutex initialization. 100 */ 101 #define JEMALLOC_MUTEX_INIT_CB 1 102 103 /* Non-empty if the tls_model attribute is supported. */ 104 #define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec"))) 105 106 /* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */ 107 #define JEMALLOC_CC_SILENCE 108 109 /* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */ 110 /* #undef JEMALLOC_CODE_COVERAGE */ 111 112 /* 113 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables 114 * inline functions. 115 */ 116 /* #undef JEMALLOC_DEBUG */ 117 118 /* JEMALLOC_STATS enables statistics calculation. */ 119 #define JEMALLOC_STATS 120 121 /* JEMALLOC_PROF enables allocation profiling. */ 122 /* #undef JEMALLOC_PROF */ 123 124 /* Use libunwind for profile backtracing if defined. */ 125 /* #undef JEMALLOC_PROF_LIBUNWIND */ 126 127 /* Use libgcc for profile backtracing if defined. */ 128 /* #undef JEMALLOC_PROF_LIBGCC */ 129 130 /* Use gcc intrinsics for profile backtracing if defined. */ 131 /* #undef JEMALLOC_PROF_GCC */ 132 133 /* 134 * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects. 135 * This makes it possible to allocate/deallocate objects without any locking 136 * when the cache is in the steady state. 137 */ 138 #define JEMALLOC_TCACHE 139 140 /* 141 * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage 142 * segment (DSS). 143 */ 144 #define JEMALLOC_DSS 145 146 /* Support memory filling (junk/zero/quarantine/redzone). */ 147 #define JEMALLOC_FILL 148 149 /* Support utrace(2)-based tracing. */ 150 #define JEMALLOC_UTRACE 151 152 /* Support Valgrind. */ 153 /* #undef JEMALLOC_VALGRIND */ 154 155 /* Support optional abort() on OOM. */ 156 #define JEMALLOC_XMALLOC 157 158 /* Support lazy locking (avoid locking unless a second thread is launched). */ 159 #define JEMALLOC_LAZY_LOCK 160 161 /* Minimum size class to support is 2^LG_TINY_MIN bytes. */ 162 #define LG_TINY_MIN 3 163 164 /* 165 * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size 166 * classes). 167 */ 168 /* #undef LG_QUANTUM */ 169 170 /* One page is 2^LG_PAGE bytes. */ 171 #define LG_PAGE 12 172 173 /* 174 * If defined, adjacent virtual memory mappings with identical attributes 175 * automatically coalesce, and they fragment when changes are made to subranges. 176 * This is the normal order of things for mmap()/munmap(), but on Windows 177 * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e. 178 * mappings do *not* coalesce/fragment. 179 */ 180 #define JEMALLOC_MAPS_COALESCE 181 182 /* 183 * If defined, use munmap() to unmap freed chunks, rather than storing them for 184 * later reuse. This is disabled by default on Linux because common sequences 185 * of mmap()/munmap() calls will cause virtual memory map holes. 186 */ 187 #define JEMALLOC_MUNMAP 188 189 /* TLS is used to map arenas and magazine caches to threads. */ 190 #define JEMALLOC_TLS 191 192 /* 193 * ffs()/ffsl() functions to use for bitmapping. Don't use these directly; 194 * instead, use jemalloc_ffs() or jemalloc_ffsl() from util.h. 195 */ 196 #define JEMALLOC_INTERNAL_FFSL __builtin_ffsl 197 #define JEMALLOC_INTERNAL_FFS __builtin_ffs 198 199 /* 200 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside 201 * within jemalloc-owned chunks before dereferencing them. 202 */ 203 /* #undef JEMALLOC_IVSALLOC */ 204 205 /* 206 * If defined, explicitly attempt to more uniformly distribute large allocation 207 * pointer alignments across all cache indices. 208 */ 209 #define JEMALLOC_CACHE_OBLIVIOUS 210 211 /* 212 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings. 213 */ 214 /* #undef JEMALLOC_ZONE */ 215 /* #undef JEMALLOC_ZONE_VERSION */ 216 217 /* 218 * Methods for purging unused pages differ between operating systems. 219 * 220 * madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages, 221 * such that new pages will be demand-zeroed if 222 * the address region is later touched. 223 * madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being 224 * unused, such that they will be discarded rather 225 * than swapped out. 226 */ 227 /* #undef JEMALLOC_PURGE_MADVISE_DONTNEED */ 228 #define JEMALLOC_PURGE_MADVISE_FREE 229 230 /* Define if operating system has alloca.h header. */ 231 /* #undef JEMALLOC_HAS_ALLOCA_H */ 232 233 /* C99 restrict keyword supported. */ 234 #define JEMALLOC_HAS_RESTRICT 1 235 236 /* For use by hash code. */ 237 /* #undef JEMALLOC_BIG_ENDIAN */ 238 239 /* sizeof(int) == 2^LG_SIZEOF_INT. */ 240 #define LG_SIZEOF_INT 2 241 242 /* sizeof(long) == 2^LG_SIZEOF_LONG. */ 243 #define LG_SIZEOF_LONG 3 244 245 /* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */ 246 #define LG_SIZEOF_INTMAX_T 3 247 248 /* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */ 249 /* #undef JEMALLOC_GLIBC_MALLOC_HOOK */ 250 251 /* glibc memalign hook. */ 252 /* #undef JEMALLOC_GLIBC_MEMALIGN_HOOK */ 253 254 /* Adaptive mutex support in pthreads. */ 255 #define JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP 256 257 /* 258 * If defined, jemalloc symbols are not exported (doesn't work when 259 * JEMALLOC_PREFIX is not defined). 260 */ 261 /* #undef JEMALLOC_EXPORT */ 262 263 #endif /* JEMALLOC_INTERNAL_DEFS_H_ */ 264