• 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 madvise(2) is available.
60 */
61#undef JEMALLOC_HAVE_MADVISE
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/*
70 * Defined if secure_getenv(3) is available.
71 */
72#undef JEMALLOC_HAVE_SECURE_GETENV
73
74/*
75 * Defined if issetugid(2) is available.
76 */
77#undef JEMALLOC_HAVE_ISSETUGID
78
79/*
80 * Defined if _malloc_thread_cleanup() exists.  At least in the case of
81 * FreeBSD, pthread_key_create() allocates, which if used during malloc
82 * bootstrapping will cause recursion into the pthreads library.  Therefore, if
83 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
84 * malloc_tsd.
85 */
86#undef JEMALLOC_MALLOC_THREAD_CLEANUP
87
88/*
89 * Defined if threaded initialization is known to be safe on this platform.
90 * Among other things, it must be possible to initialize a mutex without
91 * triggering allocation in order for threaded allocation to be safe.
92 */
93#undef JEMALLOC_THREADED_INIT
94
95/*
96 * Defined if the pthreads implementation defines
97 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
98 * to avoid recursive allocation during mutex initialization.
99 */
100#undef JEMALLOC_MUTEX_INIT_CB
101
102/* Non-empty if the tls_model attribute is supported. */
103#undef JEMALLOC_TLS_MODEL
104
105/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
106#undef JEMALLOC_CC_SILENCE
107
108/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
109#undef JEMALLOC_CODE_COVERAGE
110
111/*
112 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
113 * inline functions.
114 */
115#undef JEMALLOC_DEBUG
116
117/* JEMALLOC_STATS enables statistics calculation. */
118#undef JEMALLOC_STATS
119
120/* JEMALLOC_PROF enables allocation profiling. */
121#undef JEMALLOC_PROF
122
123/* Use libunwind for profile backtracing if defined. */
124#undef JEMALLOC_PROF_LIBUNWIND
125
126/* Use libgcc for profile backtracing if defined. */
127#undef JEMALLOC_PROF_LIBGCC
128
129/* Use gcc intrinsics for profile backtracing if defined. */
130#undef JEMALLOC_PROF_GCC
131
132/*
133 * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
134 * This makes it possible to allocate/deallocate objects without any locking
135 * when the cache is in the steady state.
136 */
137#undef JEMALLOC_TCACHE
138
139/*
140 * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
141 * segment (DSS).
142 */
143#undef JEMALLOC_DSS
144
145/* Support memory filling (junk/zero/quarantine/redzone). */
146#undef JEMALLOC_FILL
147
148/* Support utrace(2)-based tracing. */
149#undef JEMALLOC_UTRACE
150
151/* Support Valgrind. */
152#undef JEMALLOC_VALGRIND
153
154/* Support optional abort() on OOM. */
155#undef JEMALLOC_XMALLOC
156
157/* Support lazy locking (avoid locking unless a second thread is launched). */
158#undef JEMALLOC_LAZY_LOCK
159
160/* Minimum size class to support is 2^LG_TINY_MIN bytes. */
161#undef LG_TINY_MIN
162
163/*
164 * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
165 * classes).
166 */
167#undef LG_QUANTUM
168
169/* One page is 2^LG_PAGE bytes. */
170#undef LG_PAGE
171
172/*
173 * If defined, adjacent virtual memory mappings with identical attributes
174 * automatically coalesce, and they fragment when changes are made to subranges.
175 * This is the normal order of things for mmap()/munmap(), but on Windows
176 * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
177 * mappings do *not* coalesce/fragment.
178 */
179#undef JEMALLOC_MAPS_COALESCE
180
181/*
182 * If defined, use munmap() to unmap freed chunks, rather than storing them for
183 * later reuse.  This is disabled by default on Linux because common sequences
184 * of mmap()/munmap() calls will cause virtual memory map holes.
185 */
186#undef JEMALLOC_MUNMAP
187
188/* TLS is used to map arenas and magazine caches to threads. */
189#undef JEMALLOC_TLS
190
191/*
192 * ffs*() functions to use for bitmapping.  Don't use these directly; instead,
193 * use ffs_*() from util.h.
194 */
195#undef JEMALLOC_INTERNAL_FFSLL
196#undef JEMALLOC_INTERNAL_FFSL
197#undef JEMALLOC_INTERNAL_FFS
198
199/*
200 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
201 * within jemalloc-owned chunks before dereferencing them.
202 */
203#undef JEMALLOC_IVSALLOC
204
205/*
206 * If defined, explicitly attempt to more uniformly distribute large allocation
207 * pointer alignments across all cache indices.
208 */
209#undef JEMALLOC_CACHE_OBLIVIOUS
210
211/*
212 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
213 */
214#undef JEMALLOC_ZONE
215#undef JEMALLOC_ZONE_VERSION
216
217/*
218 * Methods for purging unused pages differ between operating systems.
219 *
220 *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
221 *                                 such that new pages will be demand-zeroed if
222 *                                 the address region is later touched.
223 *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
224 *                             unused, such that they will be discarded rather
225 *                             than swapped out.
226 */
227#undef JEMALLOC_PURGE_MADVISE_DONTNEED
228#undef JEMALLOC_PURGE_MADVISE_FREE
229
230/* Define if operating system has alloca.h header. */
231#undef JEMALLOC_HAS_ALLOCA_H
232
233/* C99 restrict keyword supported. */
234#undef JEMALLOC_HAS_RESTRICT
235
236/* For use by hash code. */
237#undef JEMALLOC_BIG_ENDIAN
238
239/* sizeof(int) == 2^LG_SIZEOF_INT. */
240#undef LG_SIZEOF_INT
241
242/* sizeof(long) == 2^LG_SIZEOF_LONG. */
243#undef LG_SIZEOF_LONG
244
245/* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
246#undef LG_SIZEOF_LONG_LONG
247
248/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
249#undef LG_SIZEOF_INTMAX_T
250
251/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
252#undef JEMALLOC_GLIBC_MALLOC_HOOK
253
254/* glibc memalign hook. */
255#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
256
257/* Adaptive mutex support in pthreads. */
258#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
259
260/*
261 * If defined, jemalloc symbols are not exported (doesn't work when
262 * JEMALLOC_PREFIX is not defined).
263 */
264#undef JEMALLOC_EXPORT
265
266/* config.malloc_conf options string. */
267#undef JEMALLOC_CONFIG_MALLOC_CONF
268
269#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
270