1 #ifndef JEMALLOC_INTERNAL_EXTERNS_H 2 #define JEMALLOC_INTERNAL_EXTERNS_H 3 4 #include "jemalloc/internal/atomic.h" 5 #include "jemalloc/internal/tsd_types.h" 6 7 /* TSD checks this to set thread local slow state accordingly. */ 8 extern bool malloc_slow; 9 10 /* Run-time options. */ 11 extern bool opt_abort; 12 extern bool opt_abort_conf; 13 extern bool opt_confirm_conf; 14 extern const char *opt_junk; 15 extern bool opt_junk_alloc; 16 extern bool opt_junk_free; 17 extern bool opt_utrace; 18 extern bool opt_xmalloc; 19 extern bool opt_zero; 20 extern unsigned opt_narenas; 21 22 /* Number of CPUs. */ 23 extern unsigned ncpus; 24 25 /* Number of arenas used for automatic multiplexing of threads and arenas. */ 26 extern unsigned narenas_auto; 27 28 /* Base index for manual arenas. */ 29 extern unsigned manual_arena_base; 30 31 /* 32 * Arenas that are used to service external requests. Not all elements of the 33 * arenas array are necessarily used; arenas are created lazily as needed. 34 */ 35 extern atomic_p_t arenas[]; 36 37 void *a0malloc(size_t size); 38 void a0dalloc(void *ptr); 39 void *bootstrap_malloc(size_t size); 40 void *bootstrap_calloc(size_t num, size_t size); 41 void bootstrap_free(void *ptr); 42 void arena_set(unsigned ind, arena_t *arena); 43 unsigned narenas_total_get(void); 44 arena_t *arena_init(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks); 45 arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind); 46 arena_t *arena_choose_hard(tsd_t *tsd, bool internal); 47 void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind); 48 void iarena_cleanup(tsd_t *tsd); 49 void arena_cleanup(tsd_t *tsd); 50 void arenas_tdata_cleanup(tsd_t *tsd); 51 void jemalloc_prefork(void); 52 void jemalloc_postfork_parent(void); 53 void jemalloc_postfork_child(void); 54 bool malloc_initialized(void); 55 void je_sdallocx_noflags(void *ptr, size_t size); 56 57 #endif /* JEMALLOC_INTERNAL_EXTERNS_H */ 58