1 | #ifndef JEMALLOC_INTERNAL_EXTERNS_H |
2 | #define JEMALLOC_INTERNAL_EXTERNS_H |
3 | |
4 | #include "jemalloc/internal/atomic.h" |
5 | #include "jemalloc/internal/hpa_opts.h" |
6 | #include "jemalloc/internal/sec_opts.h" |
7 | #include "jemalloc/internal/tsd_types.h" |
8 | #include "jemalloc/internal/nstime.h" |
9 | |
10 | /* TSD checks this to set thread local slow state accordingly. */ |
11 | extern bool malloc_slow; |
12 | |
13 | /* Run-time options. */ |
14 | extern bool opt_abort; |
15 | extern bool opt_abort_conf; |
16 | extern bool opt_trust_madvise; |
17 | extern bool opt_confirm_conf; |
18 | extern bool opt_hpa; |
19 | extern hpa_shard_opts_t opt_hpa_opts; |
20 | extern sec_opts_t opt_hpa_sec_opts; |
21 | |
22 | extern const char *opt_junk; |
23 | extern bool opt_junk_alloc; |
24 | extern bool opt_junk_free; |
25 | extern void (*junk_free_callback)(void *ptr, size_t size); |
26 | extern void (*junk_alloc_callback)(void *ptr, size_t size); |
27 | extern bool opt_utrace; |
28 | extern bool opt_xmalloc; |
29 | extern bool opt_experimental_infallible_new; |
30 | extern bool opt_zero; |
31 | extern unsigned opt_narenas; |
32 | extern zero_realloc_action_t opt_zero_realloc_action; |
33 | extern malloc_init_t malloc_init_state; |
34 | extern const char *zero_realloc_mode_names[]; |
35 | extern atomic_zu_t zero_realloc_count; |
36 | extern bool opt_cache_oblivious; |
37 | extern unsigned opt_debug_double_free_max_scan; |
38 | |
39 | /* Escape free-fastpath when ptr & mask == 0 (for sanitization purpose). */ |
40 | extern uintptr_t san_cache_bin_nonfast_mask; |
41 | |
42 | /* Number of CPUs. */ |
43 | extern unsigned ncpus; |
44 | |
45 | /* Number of arenas used for automatic multiplexing of threads and arenas. */ |
46 | extern unsigned narenas_auto; |
47 | |
48 | /* Base index for manual arenas. */ |
49 | extern unsigned manual_arena_base; |
50 | |
51 | /* |
52 | * Arenas that are used to service external requests. Not all elements of the |
53 | * arenas array are necessarily used; arenas are created lazily as needed. |
54 | */ |
55 | extern atomic_p_t arenas[]; |
56 | |
57 | void *a0malloc(size_t size); |
58 | void a0dalloc(void *ptr); |
59 | void *bootstrap_malloc(size_t size); |
60 | void *bootstrap_calloc(size_t num, size_t size); |
61 | void bootstrap_free(void *ptr); |
62 | void arena_set(unsigned ind, arena_t *arena); |
63 | unsigned narenas_total_get(void); |
64 | arena_t *arena_init(tsdn_t *tsdn, unsigned ind, const arena_config_t *config); |
65 | arena_t *arena_choose_hard(tsd_t *tsd, bool internal); |
66 | void arena_migrate(tsd_t *tsd, arena_t *oldarena, arena_t *newarena); |
67 | void iarena_cleanup(tsd_t *tsd); |
68 | void arena_cleanup(tsd_t *tsd); |
69 | size_t batch_alloc(void **ptrs, size_t num, size_t size, int flags); |
70 | void jemalloc_prefork(void); |
71 | void jemalloc_postfork_parent(void); |
72 | void jemalloc_postfork_child(void); |
73 | void je_sdallocx_noflags(void *ptr, size_t size); |
74 | void *malloc_default(size_t size); |
75 | |
76 | #endif /* JEMALLOC_INTERNAL_EXTERNS_H */ |
77 | |