summaryrefslogtreecommitdiff
path: root/include/jemalloc/internal/jemalloc_internal_defs.h.in
blob: f5d94ee702ac0ac1ff1c758f72984d7a13b5c90f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
#ifndef JEMALLOC_INTERNAL_DEFS_H_
#define JEMALLOC_INTERNAL_DEFS_H_
/*
 * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
 * public APIs to be prefixed.  This makes it possible, with some care, to use
 * multiple allocators simultaneously.
 */
#undef JEMALLOC_PREFIX
#undef JEMALLOC_CPREFIX

/*
 * Define overrides for non-standard allocator-related functions if they are
 * present on the system.
 */
#undef JEMALLOC_OVERRIDE___LIBC_CALLOC
#undef JEMALLOC_OVERRIDE___LIBC_FREE
#undef JEMALLOC_OVERRIDE___LIBC_MALLOC
#undef JEMALLOC_OVERRIDE___LIBC_MEMALIGN
#undef JEMALLOC_OVERRIDE___LIBC_REALLOC
#undef JEMALLOC_OVERRIDE___LIBC_VALLOC
#undef JEMALLOC_OVERRIDE___LIBC_PVALLOC
#undef JEMALLOC_OVERRIDE___POSIX_MEMALIGN

/*
 * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
 * For shared libraries, symbol visibility mechanisms prevent these symbols
 * from being exported, but for static libraries, naming collisions are a real
 * possibility.
 */
#undef JEMALLOC_PRIVATE_NAMESPACE

/*
 * Hyper-threaded CPUs may need a special instruction inside spin loops in
 * order to yield to another virtual CPU.
 */
#undef CPU_SPINWAIT
/* 1 if CPU_SPINWAIT is defined, 0 otherwise. */
#undef HAVE_CPU_SPINWAIT

/*
 * Number of significant bits in virtual addresses.  This may be less than the
 * total number of bits in a pointer, e.g. on x64, for which the uppermost 16
 * bits are the same as bit 47.
 */
#undef LG_VADDR

/* Defined if C11 atomics are available. */
#undef JEMALLOC_C11_ATOMICS

/* Defined if GCC __atomic atomics are available. */
#undef JEMALLOC_GCC_ATOMIC_ATOMICS
/* and the 8-bit variant support. */
#undef JEMALLOC_GCC_U8_ATOMIC_ATOMICS

/* Defined if GCC __sync atomics are available. */
#undef JEMALLOC_GCC_SYNC_ATOMICS
/* and the 8-bit variant support. */
#undef JEMALLOC_GCC_U8_SYNC_ATOMICS

/*
 * Defined if __builtin_clz() and __builtin_clzl() are available.
 */
#undef JEMALLOC_HAVE_BUILTIN_CLZ

/*
 * Defined if os_unfair_lock_*() functions are available, as provided by Darwin.
 */
#undef JEMALLOC_OS_UNFAIR_LOCK

/* Defined if syscall(2) is usable. */
#undef JEMALLOC_USE_SYSCALL

/*
 * Defined if secure_getenv(3) is available.
 */
#undef JEMALLOC_HAVE_SECURE_GETENV

/*
 * Defined if issetugid(2) is available.
 */
#undef JEMALLOC_HAVE_ISSETUGID

/* Defined if pthread_atfork(3) is available. */
#undef JEMALLOC_HAVE_PTHREAD_ATFORK

/* Defined if pthread_setname_np(3) is available. */
#undef JEMALLOC_HAVE_PTHREAD_SETNAME_NP

/* Defined if pthread_getname_np(3) is available. */
#undef JEMALLOC_HAVE_PTHREAD_GETNAME_NP

/* Defined if pthread_get_name_np(3) is available. */
#undef JEMALLOC_HAVE_PTHREAD_GET_NAME_NP

/*
 * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
 */
#undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE

/*
 * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.
 */
#undef JEMALLOC_HAVE_CLOCK_MONOTONIC

/*
 * Defined if mach_absolute_time() is available.
 */
#undef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME

/*
 * Defined if clock_gettime(CLOCK_REALTIME, ...) is available.
 */
#undef JEMALLOC_HAVE_CLOCK_REALTIME

/*
 * Defined if _malloc_thread_cleanup() exists.  At least in the case of
 * FreeBSD, pthread_key_create() allocates, which if used during malloc
 * bootstrapping will cause recursion into the pthreads library.  Therefore, if
 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
 * malloc_tsd.
 */
#undef JEMALLOC_MALLOC_THREAD_CLEANUP

/*
 * Defined if threaded initialization is known to be safe on this platform.
 * Among other things, it must be possible to initialize a mutex without
 * triggering allocation in order for threaded allocation to be safe.
 */
#undef JEMALLOC_THREADED_INIT

/*
 * Defined if the pthreads implementation defines
 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
 * to avoid recursive allocation during mutex initialization.
 */
#undef JEMALLOC_MUTEX_INIT_CB

/* Non-empty if the tls_model attribute is supported. */
#undef JEMALLOC_TLS_MODEL

/*
 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
 * inline functions.
 */
#undef JEMALLOC_DEBUG

/* JEMALLOC_STATS enables statistics calculation. */
#undef JEMALLOC_STATS

/* JEMALLOC_EXPERIMENTAL_SMALLOCX_API enables experimental smallocx API. */
#undef JEMALLOC_EXPERIMENTAL_SMALLOCX_API

/* JEMALLOC_PROF enables allocation profiling. */
#undef JEMALLOC_PROF

/* Use libunwind for profile backtracing if defined. */
#undef JEMALLOC_PROF_LIBUNWIND

/* Use libgcc for profile backtracing if defined. */
#undef JEMALLOC_PROF_LIBGCC

/* Use gcc intrinsics for profile backtracing if defined. */
#undef JEMALLOC_PROF_GCC

/* JEMALLOC_PAGEID enabled page id */
#undef JEMALLOC_PAGEID

/* JEMALLOC_HAVE_PRCTL checks prctl */
#undef JEMALLOC_HAVE_PRCTL

/*
 * JEMALLOC_DSS enables use of sbrk(2) to allocate extents from the data storage
 * segment (DSS).
 */
#undef JEMALLOC_DSS

/* Support memory filling (junk/zero). */
#undef JEMALLOC_FILL

/* Support utrace(2)-based tracing. */
#undef JEMALLOC_UTRACE

/* Support utrace(2)-based tracing (label based signature). */
#undef JEMALLOC_UTRACE_LABEL

/* Support optional abort() on OOM. */
#undef JEMALLOC_XMALLOC

/* Support lazy locking (avoid locking unless a second thread is launched). */
#undef JEMALLOC_LAZY_LOCK

/*
 * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
 * classes).
 */
#undef LG_QUANTUM

/* One page is 2^LG_PAGE bytes. */
#undef LG_PAGE

/* Maximum number of regions in a slab. */
#undef CONFIG_LG_SLAB_MAXREGS

/*
 * One huge page is 2^LG_HUGEPAGE bytes.  Note that this is defined even if the
 * system does not explicitly support huge pages; system calls that require
 * explicit huge page support are separately configured.
 */
#undef LG_HUGEPAGE

/*
 * If defined, adjacent virtual memory mappings with identical attributes
 * automatically coalesce, and they fragment when changes are made to subranges.
 * This is the normal order of things for mmap()/munmap(), but on Windows
 * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
 * mappings do *not* coalesce/fragment.
 */
#undef JEMALLOC_MAPS_COALESCE

/*
 * If defined, retain memory for later reuse by default rather than using e.g.
 * munmap() to unmap freed extents.  This is enabled on 64-bit Linux because
 * common sequences of mmap()/munmap() calls will cause virtual memory map
 * holes.
 */
#undef JEMALLOC_RETAIN

/* TLS is used to map arenas and magazine caches to threads. */
#undef JEMALLOC_TLS

/*
 * Used to mark unreachable code to quiet "end of non-void" compiler warnings.
 * Don't use this directly; instead use unreachable() from util.h
 */
#undef JEMALLOC_INTERNAL_UNREACHABLE

/*
 * ffs*() functions to use for bitmapping.  Don't use these directly; instead,
 * use ffs_*() from util.h.
 */
#undef JEMALLOC_INTERNAL_FFSLL
#undef JEMALLOC_INTERNAL_FFSL
#undef JEMALLOC_INTERNAL_FFS

/*
 * popcount*() functions to use for bitmapping.
 */
#undef JEMALLOC_INTERNAL_POPCOUNTL
#undef JEMALLOC_INTERNAL_POPCOUNT

/*
 * If defined, explicitly attempt to more uniformly distribute large allocation
 * pointer alignments across all cache indices.
 */
#undef JEMALLOC_CACHE_OBLIVIOUS

/*
 * If defined, enable logging facilities.  We make this a configure option to
 * avoid taking extra branches everywhere.
 */
#undef JEMALLOC_LOG

/*
 * If defined, use readlinkat() (instead of readlink()) to follow
 * /etc/malloc_conf.
 */
#undef JEMALLOC_READLINKAT

/*
 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
 */
#undef JEMALLOC_ZONE

/*
 * Methods for determining whether the OS overcommits.
 * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's
 *                                         /proc/sys/vm.overcommit_memory file.
 * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl.
 */
#undef JEMALLOC_SYSCTL_VM_OVERCOMMIT
#undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY

/* Defined if madvise(2) is available. */
#undef JEMALLOC_HAVE_MADVISE

/*
 * Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE
 * arguments to madvise(2).
 */
#undef JEMALLOC_HAVE_MADVISE_HUGE

/*
 * Methods for purging unused pages differ between operating systems.
 *
 *   madvise(..., MADV_FREE) : This marks pages as being unused, such that they
 *                             will be discarded rather than swapped out.
 *   madvise(..., MADV_DONTNEED) : If JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS is
 *                                 defined, this immediately discards pages,
 *                                 such that new pages will be demand-zeroed if
 *                                 the address region is later touched;
 *                                 otherwise this behaves similarly to
 *                                 MADV_FREE, though typically with higher
 *                                 system overhead.
 */
#undef JEMALLOC_PURGE_MADVISE_FREE
#undef JEMALLOC_PURGE_MADVISE_DONTNEED
#undef JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS

/* Defined if madvise(2) is available but MADV_FREE is not (x86 Linux only). */
#undef JEMALLOC_DEFINE_MADVISE_FREE

/*
 * Defined if MADV_DO[NT]DUMP is supported as an argument to madvise.
 */
#undef JEMALLOC_MADVISE_DONTDUMP

/*
 * Defined if MADV_[NO]CORE is supported as an argument to madvise.
 */
#undef JEMALLOC_MADVISE_NOCORE

/* Defined if mprotect(2) is available. */
#undef JEMALLOC_HAVE_MPROTECT

/*
 * Defined if transparent huge pages (THPs) are supported via the
 * MADV_[NO]HUGEPAGE arguments to madvise(2), and THP support is enabled.
 */
#undef JEMALLOC_THP

/* Defined if posix_madvise is available. */
#undef JEMALLOC_HAVE_POSIX_MADVISE

/*
 * Method for purging unused pages using posix_madvise.
 *
 *   posix_madvise(..., POSIX_MADV_DONTNEED)
 */
#undef JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED
#undef JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED_ZEROS

/*
 * Defined if memcntl page admin call is supported
 */
#undef JEMALLOC_HAVE_MEMCNTL

/*
 * Defined if malloc_size is supported
 */
#undef JEMALLOC_HAVE_MALLOC_SIZE

/* Define if operating system has alloca.h header. */
#undef JEMALLOC_HAS_ALLOCA_H

/* C99 restrict keyword supported. */
#undef JEMALLOC_HAS_RESTRICT

/* For use by hash code. */
#undef JEMALLOC_BIG_ENDIAN

/* sizeof(int) == 2^LG_SIZEOF_INT. */
#undef LG_SIZEOF_INT

/* sizeof(long) == 2^LG_SIZEOF_LONG. */
#undef LG_SIZEOF_LONG

/* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
#undef LG_SIZEOF_LONG_LONG

/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
#undef LG_SIZEOF_INTMAX_T

/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
#undef JEMALLOC_GLIBC_MALLOC_HOOK

/* glibc memalign hook. */
#undef JEMALLOC_GLIBC_MEMALIGN_HOOK

/* pthread support */
#undef JEMALLOC_HAVE_PTHREAD

/* dlsym() support */
#undef JEMALLOC_HAVE_DLSYM

/* Adaptive mutex support in pthreads. */
#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP

/* GNU specific sched_getcpu support */
#undef JEMALLOC_HAVE_SCHED_GETCPU

/* GNU specific sched_setaffinity support */
#undef JEMALLOC_HAVE_SCHED_SETAFFINITY

/* pthread_setaffinity_np support */
#undef JEMALLOC_HAVE_PTHREAD_SETAFFINITY_NP

/*
 * If defined, all the features necessary for background threads are present.
 */
#undef JEMALLOC_BACKGROUND_THREAD

/*
 * If defined, jemalloc symbols are not exported (doesn't work when
 * JEMALLOC_PREFIX is not defined).
 */
#undef JEMALLOC_EXPORT

/* config.malloc_conf options string. */
#undef JEMALLOC_CONFIG_MALLOC_CONF

/* If defined, jemalloc takes the malloc/free/etc. symbol names. */
#undef JEMALLOC_IS_MALLOC

/*
 * Defined if strerror_r returns char * if _GNU_SOURCE is defined.
 */
#undef JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE

/* Performs additional safety checks when defined. */
#undef JEMALLOC_OPT_SAFETY_CHECKS

/* Is C++ support being built? */
#undef JEMALLOC_ENABLE_CXX

/* Performs additional size checks when defined. */
#undef JEMALLOC_OPT_SIZE_CHECKS

/* Allows sampled junk and stash for checking use-after-free when defined. */
#undef JEMALLOC_UAF_DETECTION

/* Darwin VM_MAKE_TAG support */
#undef JEMALLOC_HAVE_VM_MAKE_TAG

/* If defined, realloc(ptr, 0) defaults to "free" instead of "alloc". */
#undef JEMALLOC_ZERO_REALLOC_DEFAULT_FREE

#endif /* JEMALLOC_INTERNAL_DEFS_H_ */