1 #ifndef JEMALLOC_PREAMBLE_H
2 #define JEMALLOC_PREAMBLE_H
4 #include "jemalloc_internal_defs.h"
5 #include "jemalloc/internal/jemalloc_internal_decls.h"
8 #include <sys/ktrace.h>
11 #include "un-namespace.h"
12 #include "libc_private.h"
14 #define JEMALLOC_NO_DEMANGLE
16 # undef JEMALLOC_IS_MALLOC
17 # define JEMALLOC_N(n) jet_##n
18 # include "jemalloc/internal/public_namespace.h"
19 # define JEMALLOC_NO_RENAME
20 # include "../jemalloc.h"
21 # undef JEMALLOC_NO_RENAME
23 # define JEMALLOC_N(n) __je_##n
24 # include "../jemalloc.h"
27 #if defined(JEMALLOC_OSATOMIC)
28 #include <libkern/OSAtomic.h>
32 #include <mach/mach_error.h>
33 #include <mach/mach_init.h>
34 #include <mach/vm_map.h>
37 #include "jemalloc/internal/jemalloc_internal_macros.h"
40 * Note that the ordering matters here; the hook itself is name-mangled. We
41 * want the inclusion of hooks to happen early, so that we hook as much as
44 #ifndef JEMALLOC_NO_PRIVATE_NAMESPACE
46 # include "jemalloc/internal/private_namespace.h"
48 # include "jemalloc/internal/private_namespace_jet.h"
51 #include "jemalloc/internal/test_hooks.h"
53 #ifdef JEMALLOC_DEFINE_MADVISE_FREE
54 # define JEMALLOC_MADV_FREE 8
57 static const bool config_debug =
64 static const bool have_dss =
71 static const bool have_madvise_huge =
72 #ifdef JEMALLOC_HAVE_MADVISE_HUGE
78 static const bool config_fill =
85 static const bool config_lazy_lock = true;
86 static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF;
87 static const bool config_prof =
94 static const bool config_prof_libgcc =
95 #ifdef JEMALLOC_PROF_LIBGCC
101 static const bool config_prof_libunwind =
102 #ifdef JEMALLOC_PROF_LIBUNWIND
108 static const bool maps_coalesce =
109 #ifdef JEMALLOC_MAPS_COALESCE
115 static const bool config_stats =
116 #ifdef JEMALLOC_STATS
122 static const bool config_tls =
129 static const bool config_utrace =
130 #ifdef JEMALLOC_UTRACE
136 static const bool config_xmalloc =
137 #ifdef JEMALLOC_XMALLOC
143 static const bool config_cache_oblivious =
144 #ifdef JEMALLOC_CACHE_OBLIVIOUS
151 * Undocumented, for jemalloc development use only at the moment. See the note
152 * in jemalloc/internal/log.h.
154 static const bool config_log =
162 * Are extra safety checks enabled; things like checking the size of sized
163 * deallocations, double-frees, etc.
165 static const bool config_opt_safety_checks =
166 #ifdef JEMALLOC_OPT_SAFETY_CHECKS
168 #elif defined(JEMALLOC_DEBUG)
170 * This lets us only guard safety checks by one flag instead of two; fast
171 * checks can guard solely by config_opt_safety_checks and run in debug mode
180 #if defined(_WIN32) || defined(JEMALLOC_HAVE_SCHED_GETCPU)
181 /* Currently percpu_arena depends on sched_getcpu. */
182 #define JEMALLOC_PERCPU_ARENA
184 static const bool have_percpu_arena =
185 #ifdef JEMALLOC_PERCPU_ARENA
192 * Undocumented, and not recommended; the application should take full
193 * responsibility for tracking provenance.
195 static const bool force_ivsalloc =
196 #ifdef JEMALLOC_FORCE_IVSALLOC
202 static const bool have_background_thread =
203 #ifdef JEMALLOC_BACKGROUND_THREAD
210 #endif /* JEMALLOC_PREAMBLE_H */