jemalloc_internal_defs.h.in revision df3f27024f193b7baeedcd9f3799b4774dd20bbf
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#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/* Defined if sbrk() is supported. */
80#undef JEMALLOC_HAVE_SBRK
81
82/* Non-empty if the tls_model attribute is supported. */
83#undef JEMALLOC_TLS_MODEL
84
85/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
86#undef JEMALLOC_CC_SILENCE
87
88/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
89#undef JEMALLOC_CODE_COVERAGE
90
91/*
92 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
93 * inline functions.
94 */
95#undef JEMALLOC_DEBUG
96
97/* JEMALLOC_STATS enables statistics calculation. */
98#undef JEMALLOC_STATS
99
100/* JEMALLOC_PROF enables allocation profiling. */
101#undef JEMALLOC_PROF
102
103/* Use libunwind for profile backtracing if defined. */
104#undef JEMALLOC_PROF_LIBUNWIND
105
106/* Use libgcc for profile backtracing if defined. */
107#undef JEMALLOC_PROF_LIBGCC
108
109/* Use gcc intrinsics for profile backtracing if defined. */
110#undef JEMALLOC_PROF_GCC
111
112/*
113 * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
114 * This makes it possible to allocate/deallocate objects without any locking
115 * when the cache is in the steady state.
116 */
117#undef JEMALLOC_TCACHE
118
119/*
120 * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
121 * segment (DSS).
122 */
123#undef JEMALLOC_DSS
124
125/* Support memory filling (junk/zero/quarantine/redzone). */
126#undef JEMALLOC_FILL
127
128/* Support utrace(2)-based tracing. */
129#undef JEMALLOC_UTRACE
130
131/* Support Valgrind. */
132#undef JEMALLOC_VALGRIND
133
134/* Support optional abort() on OOM. */
135#undef JEMALLOC_XMALLOC
136
137/* Support lazy locking (avoid locking unless a second thread is launched). */
138#undef JEMALLOC_LAZY_LOCK
139
140/* One page is 2^STATIC_PAGE_SHIFT bytes. */
141#undef STATIC_PAGE_SHIFT
142
143/*
144 * If defined, use munmap() to unmap freed chunks, rather than storing them for
145 * later reuse.  This is disabled by default on Linux because common sequences
146 * of mmap()/munmap() calls will cause virtual memory map holes.
147 */
148#undef JEMALLOC_MUNMAP
149
150/*
151 * If defined, use mremap(...MREMAP_FIXED...) for huge realloc().  This is
152 * disabled by default because it is Linux-specific and it will cause virtual
153 * memory map holes, much like munmap(2) does.
154 */
155#undef JEMALLOC_MREMAP
156
157/* TLS is used to map arenas and magazine caches to threads. */
158#undef JEMALLOC_TLS
159
160/*
161 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
162 * within jemalloc-owned chunks before dereferencing them.
163 */
164#undef JEMALLOC_IVSALLOC
165
166/*
167 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
168 */
169#undef JEMALLOC_ZONE
170#undef JEMALLOC_ZONE_VERSION
171
172/*
173 * Methods for purging unused pages differ between operating systems.
174 *
175 *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
176 *                                 such that new pages will be demand-zeroed if
177 *                                 the address region is later touched.
178 *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
179 *                             unused, such that they will be discarded rather
180 *                             than swapped out.
181 */
182#undef JEMALLOC_PURGE_MADVISE_DONTNEED
183#undef JEMALLOC_PURGE_MADVISE_FREE
184
185/*
186 * Define if operating system has alloca.h header.
187 */
188#undef JEMALLOC_HAS_ALLOCA_H
189
190/* C99 restrict keyword supported. */
191#undef JEMALLOC_HAS_RESTRICT
192
193/* For use by hash code. */
194#undef JEMALLOC_BIG_ENDIAN
195
196/* sizeof(int) == 2^LG_SIZEOF_INT. */
197#undef LG_SIZEOF_INT
198
199/* sizeof(long) == 2^LG_SIZEOF_LONG. */
200#undef LG_SIZEOF_LONG
201
202/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
203#undef LG_SIZEOF_INTMAX_T
204
205#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
206