• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
13 * For shared libraries, symbol visibility mechanisms prevent these symbols
14 * from being exported, but for static libraries, naming collisions are a real
15 * possibility.
16 */
17#undef JEMALLOC_PRIVATE_NAMESPACE
18
19/*
20 * Hyper-threaded CPUs may need a special instruction inside spin loops in
21 * order to yield to another virtual CPU.
22 */
23#undef CPU_SPINWAIT
24
25/* Defined if C11 atomics are available. */
26#undef JEMALLOC_C11ATOMICS
27
28/* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
29#undef JEMALLOC_ATOMIC9
30
31/*
32 * Defined if OSAtomic*() functions are available, as provided by Darwin, and
33 * documented in the atomic(3) manual page.
34 */
35#undef JEMALLOC_OSATOMIC
36
37/*
38 * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
39 * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
40 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
41 * functions are defined in libgcc instead of being inlines).
42 */
43#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4
44
45/*
46 * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
47 * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
48 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
49 * functions are defined in libgcc instead of being inlines).
50 */
51#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8
52
53/*
54 * Defined if __builtin_clz() and __builtin_clzl() are available.
55 */
56#undef JEMALLOC_HAVE_BUILTIN_CLZ
57
58/*
59 * Defined if os_unfair_lock_*() functions are available, as provided by Darwin.
60 */
61#undef JEMALLOC_OS_UNFAIR_LOCK
62
63/*
64 * Defined if OSSpin*() functions are available, as provided by Darwin, and
65 * documented in the spinlock(3) manual page.
66 */
67#undef JEMALLOC_OSSPIN
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/*
86 * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
87 */
88#undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE
89
90/*
91 * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.
92 */
93#undef JEMALLOC_HAVE_CLOCK_MONOTONIC
94
95/*
96 * Defined if mach_absolute_time() is available.
97 */
98#undef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
99
100/*
101 * Defined if _malloc_thread_cleanup() exists.  At least in the case of
102 * FreeBSD, pthread_key_create() allocates, which if used during malloc
103 * bootstrapping will cause recursion into the pthreads library.  Therefore, if
104 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
105 * malloc_tsd.
106 */
107#undef JEMALLOC_MALLOC_THREAD_CLEANUP
108
109/*
110 * Defined if threaded initialization is known to be safe on this platform.
111 * Among other things, it must be possible to initialize a mutex without
112 * triggering allocation in order for threaded allocation to be safe.
113 */
114#undef JEMALLOC_THREADED_INIT
115
116/*
117 * Defined if the pthreads implementation defines
118 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
119 * to avoid recursive allocation during mutex initialization.
120 */
121#undef JEMALLOC_MUTEX_INIT_CB
122
123/* Non-empty if the tls_model attribute is supported. */
124#undef JEMALLOC_TLS_MODEL
125
126/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
127#undef JEMALLOC_CC_SILENCE
128
129/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
130#undef JEMALLOC_CODE_COVERAGE
131
132/*
133 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
134 * inline functions.
135 */
136#undef JEMALLOC_DEBUG
137
138/* JEMALLOC_STATS enables statistics calculation. */
139#undef JEMALLOC_STATS
140
141/* JEMALLOC_PROF enables allocation profiling. */
142#undef JEMALLOC_PROF
143
144/* Use libunwind for profile backtracing if defined. */
145#undef JEMALLOC_PROF_LIBUNWIND
146
147/* Use libgcc for profile backtracing if defined. */
148#undef JEMALLOC_PROF_LIBGCC
149
150/* Use gcc intrinsics for profile backtracing if defined. */
151#undef JEMALLOC_PROF_GCC
152
153/*
154 * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
155 * This makes it possible to allocate/deallocate objects without any locking
156 * when the cache is in the steady state.
157 */
158#undef JEMALLOC_TCACHE
159
160/*
161 * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
162 * segment (DSS).
163 */
164#undef JEMALLOC_DSS
165
166/* Support memory filling (junk/zero/quarantine/redzone). */
167#undef JEMALLOC_FILL
168
169/* Support utrace(2)-based tracing. */
170#undef JEMALLOC_UTRACE
171
172/* Support Valgrind. */
173#undef JEMALLOC_VALGRIND
174
175/* Support optional abort() on OOM. */
176#undef JEMALLOC_XMALLOC
177
178/* Support lazy locking (avoid locking unless a second thread is launched). */
179#undef JEMALLOC_LAZY_LOCK
180
181/* Minimum size class to support is 2^LG_TINY_MIN bytes. */
182#undef LG_TINY_MIN
183
184/*
185 * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
186 * classes).
187 */
188#undef LG_QUANTUM
189
190/* One page is 2^LG_PAGE bytes. */
191#undef LG_PAGE
192
193/*
194 * If defined, adjacent virtual memory mappings with identical attributes
195 * automatically coalesce, and they fragment when changes are made to subranges.
196 * This is the normal order of things for mmap()/munmap(), but on Windows
197 * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
198 * mappings do *not* coalesce/fragment.
199 */
200#undef JEMALLOC_MAPS_COALESCE
201
202/*
203 * If defined, use munmap() to unmap freed chunks, rather than storing them for
204 * later reuse.  This is disabled by default on Linux because common sequences
205 * of mmap()/munmap() calls will cause virtual memory map holes.
206 */
207#undef JEMALLOC_MUNMAP
208
209/* TLS is used to map arenas and magazine caches to threads. */
210#undef JEMALLOC_TLS
211
212/*
213 * Used to mark unreachable code to quiet "end of non-void" compiler warnings.
214 * Don't use this directly; instead use unreachable() from util.h
215 */
216#undef JEMALLOC_INTERNAL_UNREACHABLE
217
218/*
219 * ffs*() functions to use for bitmapping.  Don't use these directly; instead,
220 * use ffs_*() from util.h.
221 */
222#undef JEMALLOC_INTERNAL_FFSLL
223#undef JEMALLOC_INTERNAL_FFSL
224#undef JEMALLOC_INTERNAL_FFS
225
226/*
227 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
228 * within jemalloc-owned chunks before dereferencing them.
229 */
230#undef JEMALLOC_IVSALLOC
231
232/*
233 * If defined, explicitly attempt to more uniformly distribute large allocation
234 * pointer alignments across all cache indices.
235 */
236#undef JEMALLOC_CACHE_OBLIVIOUS
237
238/*
239 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
240 */
241#undef JEMALLOC_ZONE
242#undef JEMALLOC_ZONE_VERSION
243
244/*
245 * Methods for determining whether the OS overcommits.
246 * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's
247 *                                         /proc/sys/vm.overcommit_memory file.
248 * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl.
249 */
250#undef JEMALLOC_SYSCTL_VM_OVERCOMMIT
251#undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY
252
253/* Defined if madvise(2) is available. */
254#undef JEMALLOC_HAVE_MADVISE
255
256/*
257 * Methods for purging unused pages differ between operating systems.
258 *
259 *   madvise(..., MADV_FREE) : This marks pages as being unused, such that they
260 *                             will be discarded rather than swapped out.
261 *   madvise(..., MADV_DONTNEED) : This immediately discards pages, such that
262 *                                 new pages will be demand-zeroed if the
263 *                                 address region is later touched.
264 */
265#undef JEMALLOC_PURGE_MADVISE_FREE
266#undef JEMALLOC_PURGE_MADVISE_DONTNEED
267
268/*
269 * Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE
270 * arguments to madvise(2).
271 */
272#undef JEMALLOC_THP
273
274/* Define if operating system has alloca.h header. */
275#undef JEMALLOC_HAS_ALLOCA_H
276
277/* C99 restrict keyword supported. */
278#undef JEMALLOC_HAS_RESTRICT
279
280/* For use by hash code. */
281#undef JEMALLOC_BIG_ENDIAN
282
283/* sizeof(int) == 2^LG_SIZEOF_INT. */
284#undef LG_SIZEOF_INT
285
286/* sizeof(long) == 2^LG_SIZEOF_LONG. */
287#undef LG_SIZEOF_LONG
288
289/* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
290#undef LG_SIZEOF_LONG_LONG
291
292/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
293#undef LG_SIZEOF_INTMAX_T
294
295/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
296#undef JEMALLOC_GLIBC_MALLOC_HOOK
297
298/* glibc memalign hook. */
299#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
300
301/* Adaptive mutex support in pthreads. */
302#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
303
304/*
305 * If defined, jemalloc symbols are not exported (doesn't work when
306 * JEMALLOC_PREFIX is not defined).
307 */
308#undef JEMALLOC_EXPORT
309
310/* config.malloc_conf options string. */
311#undef JEMALLOC_CONFIG_MALLOC_CONF
312
313#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
314