1#ifndef JEMALLOC_INTERNAL_DEFS_H_ 2#define JEMALLOC_INTERNAL_DEFS_H_ 3/* 4 * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all 5 * public APIs to be prefixed. This makes it possible, with some care, to use 6 * multiple allocators simultaneously. 7 */ 8#undef JEMALLOC_PREFIX 9#undef JEMALLOC_CPREFIX 10 11/* 12 * Define overrides for non-standard allocator-related functions if they are 13 * present on the system. 14 */ 15#undef JEMALLOC_OVERRIDE___LIBC_CALLOC 16#undef JEMALLOC_OVERRIDE___LIBC_FREE 17#undef JEMALLOC_OVERRIDE___LIBC_MALLOC 18#undef JEMALLOC_OVERRIDE___LIBC_MEMALIGN 19#undef JEMALLOC_OVERRIDE___LIBC_REALLOC 20#undef JEMALLOC_OVERRIDE___LIBC_VALLOC 21#undef JEMALLOC_OVERRIDE___POSIX_MEMALIGN 22 23/* 24 * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs. 25 * For shared libraries, symbol visibility mechanisms prevent these symbols 26 * from being exported, but for static libraries, naming collisions are a real 27 * possibility. 28 */ 29#undef JEMALLOC_PRIVATE_NAMESPACE 30 31/* 32 * Hyper-threaded CPUs may need a special instruction inside spin loops in 33 * order to yield to another virtual CPU. 34 */ 35#undef CPU_SPINWAIT 36/* 1 if CPU_SPINWAIT is defined, 0 otherwise. */ 37#undef HAVE_CPU_SPINWAIT 38 39/* 40 * Number of significant bits in virtual addresses. This may be less than the 41 * total number of bits in a pointer, e.g. on x64, for which the uppermost 16 42 * bits are the same as bit 47. 43 */ 44#undef LG_VADDR 45 46/* Defined if C11 atomics are available. */ 47#undef JEMALLOC_C11_ATOMICS 48 49/* Defined if GCC __atomic atomics are available. */ 50#undef JEMALLOC_GCC_ATOMIC_ATOMICS 51/* and the 8-bit variant support. */ 52#undef JEMALLOC_GCC_U8_ATOMIC_ATOMICS 53 54/* Defined if GCC __sync atomics are available. */ 55#undef JEMALLOC_GCC_SYNC_ATOMICS 56/* and the 8-bit variant support. */ 57#undef JEMALLOC_GCC_U8_SYNC_ATOMICS 58 59/* 60 * Defined if __builtin_clz() and __builtin_clzl() are available. 61 */ 62#undef JEMALLOC_HAVE_BUILTIN_CLZ 63 64/* 65 * Defined if os_unfair_lock_*() functions are available, as provided by Darwin. 66 */ 67#undef JEMALLOC_OS_UNFAIR_LOCK 68 69/* Defined if syscall(2) is usable. */ 70#undef JEMALLOC_USE_SYSCALL 71 72/* 73 * Defined if secure_getenv(3) is available. 74 */ 75#undef JEMALLOC_HAVE_SECURE_GETENV 76 77/* 78 * Defined if issetugid(2) is available. 79 */ 80#undef JEMALLOC_HAVE_ISSETUGID 81 82/* Defined if pthread_atfork(3) is available. */ 83#undef JEMALLOC_HAVE_PTHREAD_ATFORK 84 85/* Defined if pthread_setname_np(3) is available. */ 86#undef JEMALLOC_HAVE_PTHREAD_SETNAME_NP 87 88/* Defined if pthread_getname_np(3) is available. */ 89#undef JEMALLOC_HAVE_PTHREAD_GETNAME_NP 90 91/* Defined if pthread_get_name_np(3) is available. */ 92#undef JEMALLOC_HAVE_PTHREAD_GET_NAME_NP 93 94/* 95 * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available. 96 */ 97#undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE 98 99/* 100 * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available. 101 */ 102#undef JEMALLOC_HAVE_CLOCK_MONOTONIC 103 104/* 105 * Defined if mach_absolute_time() is available. 106 */ 107#undef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME 108 109/* 110 * Defined if clock_gettime(CLOCK_REALTIME, ...) is available. 111 */ 112#undef JEMALLOC_HAVE_CLOCK_REALTIME 113 114/* 115 * Defined if _malloc_thread_cleanup() exists. At least in the case of 116 * FreeBSD, pthread_key_create() allocates, which if used during malloc 117 * bootstrapping will cause recursion into the pthreads library. Therefore, if 118 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in 119 * malloc_tsd. 120 */ 121#undef JEMALLOC_MALLOC_THREAD_CLEANUP 122 123/* 124 * Defined if threaded initialization is known to be safe on this platform. 125 * Among other things, it must be possible to initialize a mutex without 126 * triggering allocation in order for threaded allocation to be safe. 127 */ 128#undef JEMALLOC_THREADED_INIT 129 130/* 131 * Defined if the pthreads implementation defines 132 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order 133 * to avoid recursive allocation during mutex initialization. 134 */ 135#undef JEMALLOC_MUTEX_INIT_CB 136 137/* Non-empty if the tls_model attribute is supported. */ 138#undef JEMALLOC_TLS_MODEL 139 140/* 141 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables 142 * inline functions. 143 */ 144#undef JEMALLOC_DEBUG 145 146/* JEMALLOC_STATS enables statistics calculation. */ 147#undef JEMALLOC_STATS 148 149/* JEMALLOC_EXPERIMENTAL_SMALLOCX_API enables experimental smallocx API. */ 150#undef JEMALLOC_EXPERIMENTAL_SMALLOCX_API 151 152/* JEMALLOC_PROF enables allocation profiling. */ 153#undef JEMALLOC_PROF 154 155/* Use libunwind for profile backtracing if defined. */ 156#undef JEMALLOC_PROF_LIBUNWIND 157 158/* Use libgcc for profile backtracing if defined. */ 159#undef JEMALLOC_PROF_LIBGCC 160 161/* Use gcc intrinsics for profile backtracing if defined. */ 162#undef JEMALLOC_PROF_GCC 163 164/* 165 * JEMALLOC_DSS enables use of sbrk(2) to allocate extents from the data storage 166 * segment (DSS). 167 */ 168#undef JEMALLOC_DSS 169 170/* Support memory filling (junk/zero). */ 171#undef JEMALLOC_FILL 172 173/* Support utrace(2)-based tracing. */ 174#undef JEMALLOC_UTRACE 175 176/* Support utrace(2)-based tracing (label based signature). */ 177#undef JEMALLOC_UTRACE_LABEL 178 179/* Support optional abort() on OOM. */ 180#undef JEMALLOC_XMALLOC 181 182/* Support lazy locking (avoid locking unless a second thread is launched). */ 183#undef JEMALLOC_LAZY_LOCK 184 185/* 186 * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size 187 * classes). 188 */ 189#undef LG_QUANTUM 190 191/* One page is 2^LG_PAGE bytes. */ 192#undef LG_PAGE 193 194/* Maximum number of regions in a slab. */ 195#undef CONFIG_LG_SLAB_MAXREGS 196 197/* 198 * One huge page is 2^LG_HUGEPAGE bytes. Note that this is defined even if the 199 * system does not explicitly support huge pages; system calls that require 200 * explicit huge page support are separately configured. 201 */ 202#undef LG_HUGEPAGE 203 204/* 205 * If defined, adjacent virtual memory mappings with identical attributes 206 * automatically coalesce, and they fragment when changes are made to subranges. 207 * This is the normal order of things for mmap()/munmap(), but on Windows 208 * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e. 209 * mappings do *not* coalesce/fragment. 210 */ 211#undef JEMALLOC_MAPS_COALESCE 212 213/* 214 * If defined, retain memory for later reuse by default rather than using e.g. 215 * munmap() to unmap freed extents. This is enabled on 64-bit Linux because 216 * common sequences of mmap()/munmap() calls will cause virtual memory map 217 * holes. 218 */ 219#undef JEMALLOC_RETAIN 220 221/* TLS is used to map arenas and magazine caches to threads. */ 222#undef JEMALLOC_TLS 223 224/* 225 * Used to mark unreachable code to quiet "end of non-void" compiler warnings. 226 * Don't use this directly; instead use unreachable() from util.h 227 */ 228#undef JEMALLOC_INTERNAL_UNREACHABLE 229 230/* 231 * ffs*() functions to use for bitmapping. Don't use these directly; instead, 232 * use ffs_*() from util.h. 233 */ 234#undef JEMALLOC_INTERNAL_FFSLL 235#undef JEMALLOC_INTERNAL_FFSL 236#undef JEMALLOC_INTERNAL_FFS 237 238/* 239 * popcount*() functions to use for bitmapping. 240 */ 241#undef JEMALLOC_INTERNAL_POPCOUNTL 242#undef JEMALLOC_INTERNAL_POPCOUNT 243 244/* 245 * If defined, explicitly attempt to more uniformly distribute large allocation 246 * pointer alignments across all cache indices. 247 */ 248#undef JEMALLOC_CACHE_OBLIVIOUS 249 250/* 251 * If defined, enable logging facilities. We make this a configure option to 252 * avoid taking extra branches everywhere. 253 */ 254#undef JEMALLOC_LOG 255 256/* 257 * If defined, use readlinkat() (instead of readlink()) to follow 258 * /etc/malloc_conf. 259 */ 260#undef JEMALLOC_READLINKAT 261 262/* 263 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings. 264 */ 265#undef JEMALLOC_ZONE 266 267/* 268 * Methods for determining whether the OS overcommits. 269 * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's 270 * /proc/sys/vm.overcommit_memory file. 271 * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl. 272 */ 273#undef JEMALLOC_SYSCTL_VM_OVERCOMMIT 274#undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY 275 276/* Defined if madvise(2) is available. */ 277#undef JEMALLOC_HAVE_MADVISE 278 279/* 280 * Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE 281 * arguments to madvise(2). 282 */ 283#undef JEMALLOC_HAVE_MADVISE_HUGE 284 285/* 286 * Methods for purging unused pages differ between operating systems. 287 * 288 * madvise(..., MADV_FREE) : This marks pages as being unused, such that they 289 * will be discarded rather than swapped out. 290 * madvise(..., MADV_DONTNEED) : If JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS is 291 * defined, this immediately discards pages, 292 * such that new pages will be demand-zeroed if 293 * the address region is later touched; 294 * otherwise this behaves similarly to 295 * MADV_FREE, though typically with higher 296 * system overhead. 297 */ 298#undef JEMALLOC_PURGE_MADVISE_FREE 299#undef JEMALLOC_PURGE_MADVISE_DONTNEED 300#undef JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS 301 302/* Defined if madvise(2) is available but MADV_FREE is not (x86 Linux only). */ 303#undef JEMALLOC_DEFINE_MADVISE_FREE 304 305/* 306 * Defined if MADV_DO[NT]DUMP is supported as an argument to madvise. 307 */ 308#undef JEMALLOC_MADVISE_DONTDUMP 309 310/* 311 * Defined if MADV_[NO]CORE is supported as an argument to madvise. 312 */ 313#undef JEMALLOC_MADVISE_NOCORE 314 315/* Defined if mprotect(2) is available. */ 316#undef JEMALLOC_HAVE_MPROTECT 317 318/* 319 * Defined if transparent huge pages (THPs) are supported via the 320 * MADV_[NO]HUGEPAGE arguments to madvise(2), and THP support is enabled. 321 */ 322#undef JEMALLOC_THP 323 324/* Defined if posix_madvise is available. */ 325#undef JEMALLOC_HAVE_POSIX_MADVISE 326 327/* 328 * Method for purging unused pages using posix_madvise. 329 * 330 * posix_madvise(..., POSIX_MADV_DONTNEED) 331 */ 332#undef JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED 333#undef JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED_ZEROS 334 335/* 336 * Defined if memcntl page admin call is supported 337 */ 338#undef JEMALLOC_HAVE_MEMCNTL 339 340/* 341 * Defined if malloc_size is supported 342 */ 343#undef JEMALLOC_HAVE_MALLOC_SIZE 344 345/* Define if operating system has alloca.h header. */ 346#undef JEMALLOC_HAS_ALLOCA_H 347 348/* C99 restrict keyword supported. */ 349#undef JEMALLOC_HAS_RESTRICT 350 351/* For use by hash code. */ 352#undef JEMALLOC_BIG_ENDIAN 353 354/* sizeof(int) == 2^LG_SIZEOF_INT. */ 355#undef LG_SIZEOF_INT 356 357/* sizeof(long) == 2^LG_SIZEOF_LONG. */ 358#undef LG_SIZEOF_LONG 359 360/* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */ 361#undef LG_SIZEOF_LONG_LONG 362 363/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */ 364#undef LG_SIZEOF_INTMAX_T 365 366/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */ 367#undef JEMALLOC_GLIBC_MALLOC_HOOK 368 369/* glibc memalign hook. */ 370#undef JEMALLOC_GLIBC_MEMALIGN_HOOK 371 372/* pthread support */ 373#undef JEMALLOC_HAVE_PTHREAD 374 375/* dlsym() support */ 376#undef JEMALLOC_HAVE_DLSYM 377 378/* Adaptive mutex support in pthreads. */ 379#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP 380 381/* GNU specific sched_getcpu support */ 382#undef JEMALLOC_HAVE_SCHED_GETCPU 383 384/* GNU specific sched_setaffinity support */ 385#undef JEMALLOC_HAVE_SCHED_SETAFFINITY 386 387/* 388 * If defined, all the features necessary for background threads are present. 389 */ 390#undef JEMALLOC_BACKGROUND_THREAD 391 392/* 393 * If defined, jemalloc symbols are not exported (doesn't work when 394 * JEMALLOC_PREFIX is not defined). 395 */ 396#undef JEMALLOC_EXPORT 397 398/* config.malloc_conf options string. */ 399#undef JEMALLOC_CONFIG_MALLOC_CONF 400 401/* If defined, jemalloc takes the malloc/free/etc. symbol names. */ 402#undef JEMALLOC_IS_MALLOC 403 404/* 405 * Defined if strerror_r returns char * if _GNU_SOURCE is defined. 406 */ 407#undef JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE 408 409/* Performs additional safety checks when defined. */ 410#undef JEMALLOC_OPT_SAFETY_CHECKS 411 412/* Is C++ support being built? */ 413#undef JEMALLOC_ENABLE_CXX 414 415/* Performs additional size checks when defined. */ 416#undef JEMALLOC_OPT_SIZE_CHECKS 417 418/* Allows sampled junk and stash for checking use-after-free when defined. */ 419#undef JEMALLOC_UAF_DETECTION 420 421/* Darwin VM_MAKE_TAG support */ 422#undef JEMALLOC_HAVE_VM_MAKE_TAG 423 424/* If defined, realloc(ptr, 0) defaults to "free" instead of "alloc". */ 425#undef JEMALLOC_ZERO_REALLOC_DEFAULT_FREE 426 427#endif /* JEMALLOC_INTERNAL_DEFS_H_ */ 428