• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef JEMALLOC_INTERNAL_EXTERNS_H
2 #define JEMALLOC_INTERNAL_EXTERNS_H
3 
4 #include "jemalloc/internal/atomic.h"
5 #include "jemalloc/internal/size_classes.h"
6 #include "jemalloc/internal/tsd_types.h"
7 
8 /* TSD checks this to set thread local slow state accordingly. */
9 extern bool malloc_slow;
10 
11 /* Run-time options. */
12 extern bool opt_abort;
13 extern bool opt_abort_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 /*
29  * Arenas that are used to service external requests.  Not all elements of the
30  * arenas array are necessarily used; arenas are created lazily as needed.
31  */
32 extern atomic_p_t arenas[];
33 
34 void *a0malloc(size_t size);
35 void a0dalloc(void *ptr);
36 void *bootstrap_malloc(size_t size);
37 void *bootstrap_calloc(size_t num, size_t size);
38 void bootstrap_free(void *ptr);
39 void arena_set(unsigned ind, arena_t *arena);
40 unsigned narenas_total_get(void);
41 arena_t *arena_init(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks);
42 arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind);
43 arena_t *arena_choose_hard(tsd_t *tsd, bool internal);
44 void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind);
45 void iarena_cleanup(tsd_t *tsd);
46 void arena_cleanup(tsd_t *tsd);
47 void arenas_tdata_cleanup(tsd_t *tsd);
48 void jemalloc_prefork(void);
49 void jemalloc_postfork_parent(void);
50 void jemalloc_postfork_child(void);
51 bool malloc_initialized(void);
52 
53 #endif /* JEMALLOC_INTERNAL_EXTERNS_H */
54