| 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 | #define JEMALLOC_PREFIX "jem_" |
| 10 | #define JEMALLOC_CPREFIX "JEM_" |
| 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 | /* #undef JEMALLOC_ATOMIC9 */ |
| 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 | #define JEMALLOC_HAVE_SECURE_GETENV |
| 74 | |
| 75 | /* |
| 76 | * Defined if issetugid(2) is available. |
| 77 | */ |
| 78 | /* #undef 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 | /* #undef 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 | #define 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 | /* #undef JEMALLOC_MUTEX_INIT_CB */ |
| 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 | /* #undef JEMALLOC_UTRACE */ |
| 151 | |
| 152 | /* Support Valgrind. */ |
| 153 | /* #undef JEMALLOC_VALGRIND */ |
| 154 | |
| 155 | /* Support optional abort() on OOM. */ |
| 156 | /* #undef JEMALLOC_XMALLOC */ |
| 157 | |
| 158 | /* Support lazy locking (avoid locking unless a second thread is launched). */ |
| 159 | /* #undef 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 | /* #undef JEMALLOC_MUNMAP */ |
| 188 | |
| 189 | /* TLS is used to map arenas and magazine caches to threads. */ |
| 190 | #define JEMALLOC_TLS |
| 191 | |
| 192 | /* |
| 193 | * ffs*() functions to use for bitmapping. Don't use these directly; instead, |
| 194 | * use ffs_*() from util.h. |
| 195 | */ |
| 196 | #define JEMALLOC_INTERNAL_FFSLL __builtin_ffsll |
| 197 | #define JEMALLOC_INTERNAL_FFSL __builtin_ffsl |
| 198 | #define JEMALLOC_INTERNAL_FFS __builtin_ffs |
| 199 | |
| 200 | /* |
| 201 | * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside |
| 202 | * within jemalloc-owned chunks before dereferencing them. |
| 203 | */ |
| 204 | /* #undef JEMALLOC_IVSALLOC */ |
| 205 | |
| 206 | /* |
| 207 | * If defined, explicitly attempt to more uniformly distribute large allocation |
| 208 | * pointer alignments across all cache indices. |
| 209 | */ |
| 210 | #define JEMALLOC_CACHE_OBLIVIOUS |
| 211 | |
| 212 | /* |
| 213 | * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings. |
| 214 | */ |
| 215 | /* #undef JEMALLOC_ZONE */ |
| 216 | /* #undef JEMALLOC_ZONE_VERSION */ |
| 217 | |
| 218 | /* |
| 219 | * Methods for determining whether the OS overcommits. |
| 220 | * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's |
| 221 | * /proc/sys/vm.overcommit_memory file. |
| 222 | * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl. |
| 223 | */ |
| 224 | /* #undef JEMALLOC_SYSCTL_VM_OVERCOMMIT */ |
| 225 | #define JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY |
| 226 | |
| 227 | /* |
| 228 | * Methods for purging unused pages differ between operating systems. |
| 229 | * |
| 230 | * madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages, |
| 231 | * such that new pages will be demand-zeroed if |
| 232 | * the address region is later touched. |
| 233 | * madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being |
| 234 | * unused, such that they will be discarded rather |
| 235 | * than swapped out. |
| 236 | */ |
| 237 | #define JEMALLOC_PURGE_MADVISE_DONTNEED |
| 238 | /* #undef JEMALLOC_PURGE_MADVISE_FREE */ |
| 239 | |
| 240 | /* Define if operating system has alloca.h header. */ |
| 241 | #define JEMALLOC_HAS_ALLOCA_H 1 |
| 242 | |
| 243 | /* C99 restrict keyword supported. */ |
| 244 | #define JEMALLOC_HAS_RESTRICT 1 |
| 245 | |
| 246 | /* For use by hash code. */ |
| 247 | /* #undef JEMALLOC_BIG_ENDIAN */ |
| 248 | |
| 249 | /* sizeof(int) == 2^LG_SIZEOF_INT. */ |
| 250 | #define LG_SIZEOF_INT 2 |
| 251 | |
| 252 | /* sizeof(long) == 2^LG_SIZEOF_LONG. */ |
| 253 | #define LG_SIZEOF_LONG 3 |
| 254 | |
| 255 | /* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */ |
| 256 | #define LG_SIZEOF_LONG_LONG 3 |
| 257 | |
| 258 | /* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */ |
| 259 | #define LG_SIZEOF_INTMAX_T 3 |
| 260 | |
| 261 | /* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */ |
| 262 | #define JEMALLOC_GLIBC_MALLOC_HOOK |
| 263 | |
| 264 | /* glibc memalign hook. */ |
| 265 | #define JEMALLOC_GLIBC_MEMALIGN_HOOK |
| 266 | |
| 267 | /* Adaptive mutex support in pthreads. */ |
| 268 | #define JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP |
| 269 | |
| 270 | /* |
| 271 | * If defined, jemalloc symbols are not exported (doesn't work when |
| 272 | * JEMALLOC_PREFIX is not defined). |
| 273 | */ |
| 274 | /* #undef JEMALLOC_EXPORT */ |
| 275 | |
| 276 | /* config.malloc_conf options string. */ |
| 277 | #define JEMALLOC_CONFIG_MALLOC_CONF "" |
| 278 | |
| 279 | #endif /* JEMALLOC_INTERNAL_DEFS_H_ */ |
| 280 | |