1 #ifndef JEMALLOC_PREAMBLE_H 2 #define JEMALLOC_PREAMBLE_H 3 4 #include "jemalloc_internal_defs.h" 5 #include "jemalloc/internal/jemalloc_internal_decls.h" 6 7 #ifdef JEMALLOC_UTRACE 8 #include <sys/ktrace.h> 9 #endif 10 11 #define JEMALLOC_NO_DEMANGLE 12 #ifdef JEMALLOC_JET 13 # undef JEMALLOC_IS_MALLOC 14 # define JEMALLOC_N(n) jet_##n 15 # include "jemalloc/internal/public_namespace.h" 16 # define JEMALLOC_NO_RENAME 17 # include "../jemalloc.h" 18 # undef JEMALLOC_NO_RENAME 19 #else 20 # define JEMALLOC_N(n) je_##n 21 # include "../jemalloc.h" 22 #endif 23 24 #if (defined(JEMALLOC_OSATOMIC) || defined(JEMALLOC_OSSPIN)) 25 #include <libkern/OSAtomic.h> 26 #endif 27 28 #ifdef JEMALLOC_ZONE 29 #include <mach/mach_error.h> 30 #include <mach/mach_init.h> 31 #include <mach/vm_map.h> 32 #endif 33 34 #include "jemalloc/internal/jemalloc_internal_macros.h" 35 36 /* 37 * Note that the ordering matters here; the hook itself is name-mangled. We 38 * want the inclusion of hooks to happen early, so that we hook as much as 39 * possible. 40 */ 41 #ifndef JEMALLOC_NO_PRIVATE_NAMESPACE 42 # ifndef JEMALLOC_JET 43 # include "jemalloc/internal/private_namespace.h" 44 # else 45 # include "jemalloc/internal/private_namespace_jet.h" 46 # endif 47 #endif 48 #include "jemalloc/internal/hooks.h" 49 50 #ifdef JEMALLOC_DEFINE_MADVISE_FREE 51 # define JEMALLOC_MADV_FREE 8 52 #endif 53 54 static const bool config_debug = 55 #ifdef JEMALLOC_DEBUG 56 true 57 #else 58 false 59 #endif 60 ; 61 static const bool have_dss = 62 #ifdef JEMALLOC_DSS 63 true 64 #else 65 false 66 #endif 67 ; 68 static const bool have_madvise_huge = 69 #ifdef JEMALLOC_HAVE_MADVISE_HUGE 70 true 71 #else 72 false 73 #endif 74 ; 75 static const bool config_fill = 76 #ifdef JEMALLOC_FILL 77 true 78 #else 79 false 80 #endif 81 ; 82 static const bool config_lazy_lock = 83 #ifdef JEMALLOC_LAZY_LOCK 84 true 85 #else 86 false 87 #endif 88 ; 89 static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF; 90 static const bool config_prof = 91 #ifdef JEMALLOC_PROF 92 # define JEMALLOC_PROF_NORETURN 93 true 94 #else 95 # define JEMALLOC_PROF_NORETURN JEMALLOC_NORETURN 96 false 97 #endif 98 ; 99 static const bool config_prof_libgcc = 100 #ifdef JEMALLOC_PROF_LIBGCC 101 true 102 #else 103 false 104 #endif 105 ; 106 static const bool config_prof_libunwind = 107 #ifdef JEMALLOC_PROF_LIBUNWIND 108 true 109 #else 110 false 111 #endif 112 ; 113 static const bool maps_coalesce = 114 #ifdef JEMALLOC_MAPS_COALESCE 115 true 116 #else 117 false 118 #endif 119 ; 120 static const bool config_stats = 121 #ifdef JEMALLOC_STATS 122 true 123 #else 124 false 125 #endif 126 ; 127 static const bool config_tls = 128 #ifdef JEMALLOC_TLS 129 true 130 #else 131 false 132 #endif 133 ; 134 static const bool config_utrace = 135 #ifdef JEMALLOC_UTRACE 136 true 137 #else 138 false 139 #endif 140 ; 141 static const bool config_xmalloc = 142 #ifdef JEMALLOC_XMALLOC 143 true 144 #else 145 false 146 #endif 147 ; 148 static const bool config_cache_oblivious = 149 #ifdef JEMALLOC_CACHE_OBLIVIOUS 150 true 151 #else 152 false 153 #endif 154 ; 155 /* 156 * Undocumented, for jemalloc development use only at the moment. See the note 157 * in jemalloc/internal/log.h. 158 */ 159 static const bool config_log = 160 #ifdef JEMALLOC_LOG 161 true 162 #else 163 false 164 #endif 165 ; 166 #ifdef JEMALLOC_HAVE_SCHED_GETCPU 167 /* Currently percpu_arena depends on sched_getcpu. */ 168 #define JEMALLOC_PERCPU_ARENA 169 #endif 170 static const bool have_percpu_arena = 171 #ifdef JEMALLOC_PERCPU_ARENA 172 true 173 #else 174 false 175 #endif 176 ; 177 /* 178 * Undocumented, and not recommended; the application should take full 179 * responsibility for tracking provenance. 180 */ 181 static const bool force_ivsalloc = 182 #ifdef JEMALLOC_FORCE_IVSALLOC 183 true 184 #else 185 false 186 #endif 187 ; 188 static const bool have_background_thread = 189 #ifdef JEMALLOC_BACKGROUND_THREAD 190 true 191 #else 192 false 193 #endif 194 ; 195 196 #endif /* JEMALLOC_PREAMBLE_H */ 197