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 the equivalent of FreeBSD's atomic(9) functions are available. */ 27 #define JEMALLOC_ATOMIC9 1 28 29 /* 30 * Defined if OSAtomic*() functions are available, as provided by Darwin, and 31 * documented in the atomic(3) manual page. 32 */ 33 /* #undef JEMALLOC_OSATOMIC */ 34 35 /* 36 * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and 37 * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite 38 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the 39 * functions are defined in libgcc instead of being inlines) 40 */ 41 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4 */ 42 43 /* 44 * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and 45 * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite 46 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the 47 * functions are defined in libgcc instead of being inlines) 48 */ 49 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8 */ 50 51 /* 52 * Defined if OSSpin*() functions are available, as provided by Darwin, and 53 * documented in the spinlock(3) manual page. 54 */ 55 /* #undef JEMALLOC_OSSPIN */ 56 57 /* 58 * Defined if _malloc_thread_cleanup() exists. At least in the case of 59 * FreeBSD, pthread_key_create() allocates, which if used during malloc 60 * bootstrapping will cause recursion into the pthreads library. Therefore, if 61 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in 62 * malloc_tsd. 63 */ 64 #define JEMALLOC_MALLOC_THREAD_CLEANUP 65 66 /* 67 * Defined if threaded initialization is known to be safe on this platform. 68 * Among other things, it must be possible to initialize a mutex without 69 * triggering allocation in order for threaded allocation to be safe. 70 */ 71 /* #undef JEMALLOC_THREADED_INIT */ 72 73 /* 74 * Defined if the pthreads implementation defines 75 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order 76 * to avoid recursive allocation during mutex initialization. 77 */ 78 #define JEMALLOC_MUTEX_INIT_CB 1 79 80 /* Defined if sbrk() is supported. */ 81 #define JEMALLOC_HAVE_SBRK 82 83 /* Non-empty if the tls_model attribute is supported. */ 84 #define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec"))) 85 86 /* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */ 87 #define JEMALLOC_CC_SILENCE 88 89 /* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */ 90 /* #undef JEMALLOC_CODE_COVERAGE */ 91 92 /* 93 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables 94 * inline functions. 95 */ 96 /* #undef JEMALLOC_DEBUG */ 97 98 /* JEMALLOC_STATS enables statistics calculation. */ 99 #define JEMALLOC_STATS 100 101 /* JEMALLOC_PROF enables allocation profiling. */ 102 /* #undef JEMALLOC_PROF */ 103 104 /* Use libunwind for profile backtracing if defined. */ 105 /* #undef JEMALLOC_PROF_LIBUNWIND */ 106 107 /* Use libgcc for profile backtracing if defined. */ 108 /* #undef JEMALLOC_PROF_LIBGCC */ 109 110 /* Use gcc intrinsics for profile backtracing if defined. */ 111 /* #undef JEMALLOC_PROF_GCC */ 112 113 /* 114 * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects. 115 * This makes it possible to allocate/deallocate objects without any locking 116 * when the cache is in the steady state. 117 */ 118 #define JEMALLOC_TCACHE 119 120 /* 121 * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage 122 * segment (DSS). 123 */ 124 #define JEMALLOC_DSS 125 126 /* Support memory filling (junk/zero/quarantine/redzone). */ 127 #define JEMALLOC_FILL 128 129 /* Support utrace(2)-based tracing. */ 130 #define JEMALLOC_UTRACE 131 132 /* Support Valgrind. */ 133 /* #undef JEMALLOC_VALGRIND */ 134 135 /* Support optional abort() on OOM. */ 136 #define JEMALLOC_XMALLOC 137 138 /* Support lazy locking (avoid locking unless a second thread is launched). */ 139 #define JEMALLOC_LAZY_LOCK 140 141 /* One page is 2^STATIC_PAGE_SHIFT bytes. */ 142 #define STATIC_PAGE_SHIFT 12 143 144 /* 145 * If defined, use munmap() to unmap freed chunks, rather than storing them for 146 * later reuse. This is disabled by default on Linux because common sequences 147 * of mmap()/munmap() calls will cause virtual memory map holes. 148 */ 149 #define JEMALLOC_MUNMAP 150 151 /* 152 * If defined, use mremap(...MREMAP_FIXED...) for huge realloc(). This is 153 * disabled by default because it is Linux-specific and it will cause virtual 154 * memory map holes, much like munmap(2) does. 155 */ 156 /* #undef JEMALLOC_MREMAP */ 157 158 /* TLS is used to map arenas and magazine caches to threads. */ 159 #define JEMALLOC_TLS 160 161 /* 162 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside 163 * within jemalloc-owned chunks before dereferencing them. 164 */ 165 /* #undef JEMALLOC_IVSALLOC */ 166 167 /* 168 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings. 169 */ 170 /* #undef JEMALLOC_ZONE */ 171 /* #undef JEMALLOC_ZONE_VERSION */ 172 173 /* 174 * Methods for purging unused pages differ between operating systems. 175 * 176 * madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages, 177 * such that new pages will be demand-zeroed if 178 * the address region is later touched. 179 * madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being 180 * unused, such that they will be discarded rather 181 * than swapped out. 182 */ 183 /* #undef JEMALLOC_PURGE_MADVISE_DONTNEED */ 184 #define JEMALLOC_PURGE_MADVISE_FREE 185 186 /* 187 * Define if operating system has alloca.h header. 188 */ 189 /* #undef JEMALLOC_HAS_ALLOCA_H */ 190 191 /* sizeof(int) == 2^LG_SIZEOF_INT. */ 192 #define LG_SIZEOF_INT 2 193 194 /* sizeof(long) == 2^LG_SIZEOF_LONG. */ 195 #define LG_SIZEOF_LONG 3 196 197 /* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */ 198 #define LG_SIZEOF_INTMAX_T 3 199 200 #endif /* JEMALLOC_INTERNAL_DEFS_H_ */ 201