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