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