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