jemalloc_defs.h.in revision 1b523da21c8aded36dbe669a9e9ca78c3c96cad7
1/*
2 * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
3 * public APIs to be prefixed.  This makes it possible, with some care, to use
4 * multiple allocators simultaneously.
5 */
6#undef JEMALLOC_PREFIX
7#undef JEMALLOC_CPREFIX
8
9/*
10 * Name mangling for public symbols is controlled by --with-mangling and
11 * --with-jemalloc-prefix.  With default settings the je_ prefix is stripped by
12 * these macro definitions.
13 */
14#undef je_malloc_conf
15#undef je_malloc_message
16#undef je_malloc
17#undef je_calloc
18#undef je_posix_memalign
19#undef je_aligned_alloc
20#undef je_realloc
21#undef je_free
22#undef je_malloc_usable_size
23#undef je_malloc_stats_print
24#undef je_mallctl
25#undef je_mallctlnametomib
26#undef je_mallctlbymib
27#undef je_memalign
28#undef je_valloc
29#undef je_allocm
30#undef je_rallocm
31#undef je_sallocm
32#undef je_dallocm
33#undef je_nallocm
34
35/*
36 * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
37 * For shared libraries, symbol visibility mechanisms prevent these symbols
38 * from being exported, but for static libraries, naming collisions are a real
39 * possibility.
40 */
41#undef JEMALLOC_PRIVATE_NAMESPACE
42#undef JEMALLOC_N
43
44/*
45 * Hyper-threaded CPUs may need a special instruction inside spin loops in
46 * order to yield to another virtual CPU.
47 */
48#undef CPU_SPINWAIT
49
50/* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
51#undef JEMALLOC_ATOMIC9
52
53/*
54 * Defined if OSAtomic*() functions are available, as provided by Darwin, and
55 * documented in the atomic(3) manual page.
56 */
57#undef JEMALLOC_OSATOMIC
58
59/*
60 * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
61 * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
62 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
63 * functions are defined in libgcc instead of being inlines)
64 */
65#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4
66
67/*
68 * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
69 * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
70 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
71 * functions are defined in libgcc instead of being inlines)
72 */
73#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8
74
75/*
76 * Defined if OSSpin*() functions are available, as provided by Darwin, and
77 * documented in the spinlock(3) manual page.
78 */
79#undef JEMALLOC_OSSPIN
80
81/*
82 * Defined if _malloc_thread_cleanup() exists.  At least in the case of
83 * FreeBSD, pthread_key_create() allocates, which if used during malloc
84 * bootstrapping will cause recursion into the pthreads library.  Therefore, if
85 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
86 * malloc_tsd.
87 */
88#undef JEMALLOC_MALLOC_THREAD_CLEANUP
89
90/*
91 * Defined if threaded initialization is known to be safe on this platform.
92 * Among other things, it must be possible to initialize a mutex without
93 * triggering allocation in order for threaded allocation to be safe.
94 */
95#undef JEMALLOC_THREADED_INIT
96
97/*
98 * Defined if the pthreads implementation defines
99 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
100 * to avoid recursive allocation during mutex initialization.
101 */
102#undef JEMALLOC_MUTEX_INIT_CB
103
104/* Defined if __attribute__((...)) syntax is supported. */
105#undef JEMALLOC_HAVE_ATTR
106#ifdef JEMALLOC_HAVE_ATTR
107#  define JEMALLOC_ATTR(s) __attribute__((s))
108#  define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
109#  define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
110#  define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
111#  define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
112#elif _MSC_VER
113#  define JEMALLOC_ATTR(s)
114#  ifdef DLLEXPORT
115#    define JEMALLOC_EXPORT __declspec(dllexport)
116#  else
117#    define JEMALLOC_EXPORT __declspec(dllimport)
118#  endif
119#  define JEMALLOC_ALIGNED(s) __declspec(align(s))
120#  define JEMALLOC_SECTION(s) __declspec(allocate(s))
121#  define JEMALLOC_NOINLINE __declspec(noinline)
122#else
123#  define JEMALLOC_ATTR(s)
124#  define JEMALLOC_EXPORT
125#  define JEMALLOC_ALIGNED(s)
126#  define JEMALLOC_SECTION(s)
127#  define JEMALLOC_NOINLINE
128#endif
129
130/* Defined if sbrk() is supported. */
131#undef JEMALLOC_HAVE_SBRK
132
133/* Non-empty if the tls_model attribute is supported. */
134#undef JEMALLOC_TLS_MODEL
135
136/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
137#undef JEMALLOC_CC_SILENCE
138
139/*
140 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
141 * inline functions.
142 */
143#undef JEMALLOC_DEBUG
144
145/* JEMALLOC_STATS enables statistics calculation. */
146#undef JEMALLOC_STATS
147
148/* JEMALLOC_PROF enables allocation profiling. */
149#undef JEMALLOC_PROF
150
151/* Use libunwind for profile backtracing if defined. */
152#undef JEMALLOC_PROF_LIBUNWIND
153
154/* Use libgcc for profile backtracing if defined. */
155#undef JEMALLOC_PROF_LIBGCC
156
157/* Use gcc intrinsics for profile backtracing if defined. */
158#undef JEMALLOC_PROF_GCC
159
160/*
161 * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
162 * This makes it possible to allocate/deallocate objects without any locking
163 * when the cache is in the steady state.
164 */
165#undef JEMALLOC_TCACHE
166
167/*
168 * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
169 * segment (DSS).
170 */
171#undef JEMALLOC_DSS
172
173/* Support memory filling (junk/zero/quarantine/redzone). */
174#undef JEMALLOC_FILL
175
176/* Support the experimental API. */
177#undef JEMALLOC_EXPERIMENTAL
178
179/* Support utrace(2)-based tracing. */
180#undef JEMALLOC_UTRACE
181
182/* Support Valgrind. */
183#undef JEMALLOC_VALGRIND
184
185/* Support optional abort() on OOM. */
186#undef JEMALLOC_XMALLOC
187
188/* Support lazy locking (avoid locking unless a second thread is launched). */
189#undef JEMALLOC_LAZY_LOCK
190
191/* One page is 2^STATIC_PAGE_SHIFT bytes. */
192#undef STATIC_PAGE_SHIFT
193
194/*
195 * If defined, use munmap() to unmap freed chunks, rather than storing them for
196 * later reuse.  This is automatically disabled if configuration determines
197 * that common sequences of mmap()/munmap() calls will cause virtual memory map
198 * holes.
199 */
200#undef JEMALLOC_MUNMAP
201
202/* TLS is used to map arenas and magazine caches to threads. */
203#undef JEMALLOC_TLS
204
205/*
206 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
207 * within jemalloc-owned chunks before dereferencing them.
208 */
209#undef JEMALLOC_IVSALLOC
210
211/*
212 * Define overrides for non-standard allocator-related functions if they
213 * are present on the system.
214 */
215#undef JEMALLOC_OVERRIDE_MEMALIGN
216#undef JEMALLOC_OVERRIDE_VALLOC
217
218/*
219 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
220 */
221#undef JEMALLOC_ZONE
222#undef JEMALLOC_ZONE_VERSION
223
224/* If defined, use mremap(...MREMAP_FIXED...) for huge realloc(). */
225#undef JEMALLOC_MREMAP_FIXED
226
227/*
228 * Methods for purging unused pages differ between operating systems.
229 *
230 *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
231 *                                 such that new pages will be demand-zeroed if
232 *                                 the address region is later touched.
233 *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
234 *                             unused, such that they will be discarded rather
235 *                             than swapped out.
236 */
237#undef JEMALLOC_PURGE_MADVISE_DONTNEED
238#undef JEMALLOC_PURGE_MADVISE_FREE
239
240/* sizeof(void *) == 2^LG_SIZEOF_PTR. */
241#undef LG_SIZEOF_PTR
242
243/* sizeof(int) == 2^LG_SIZEOF_INT. */
244#undef LG_SIZEOF_INT
245
246/* sizeof(long) == 2^LG_SIZEOF_LONG. */
247#undef LG_SIZEOF_LONG
248
249/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
250#undef LG_SIZEOF_INTMAX_T
251