2017-04-11 09:17:55 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_EXTERNS_H
|
|
|
|
#define JEMALLOC_INTERNAL_EXTERNS_H
|
|
|
|
|
2017-04-11 10:04:40 +08:00
|
|
|
#include "jemalloc/internal/atomic.h"
|
2017-04-27 09:37:44 +08:00
|
|
|
#include "jemalloc/internal/tsd_types.h"
|
2020-06-02 21:42:44 +08:00
|
|
|
#include "jemalloc/internal/nstime.h"
|
2017-04-11 10:04:40 +08:00
|
|
|
|
2017-04-12 14:13:45 +08:00
|
|
|
/* TSD checks this to set thread local slow state accordingly. */
|
2017-05-26 06:30:11 +08:00
|
|
|
extern bool malloc_slow;
|
2017-04-12 14:13:45 +08:00
|
|
|
|
|
|
|
/* Run-time options. */
|
2017-05-26 06:30:11 +08:00
|
|
|
extern bool opt_abort;
|
|
|
|
extern bool opt_abort_conf;
|
2019-05-01 04:54:00 +08:00
|
|
|
extern bool opt_confirm_conf;
|
2020-08-15 04:36:41 +08:00
|
|
|
extern bool opt_hpa;
|
2020-09-05 06:22:47 +08:00
|
|
|
extern size_t opt_hpa_slab_goal;
|
|
|
|
extern size_t opt_hpa_slab_max_alloc;
|
2020-09-05 09:29:28 +08:00
|
|
|
extern size_t opt_hpa_small_max;
|
|
|
|
extern size_t opt_hpa_large_min;
|
2020-10-17 04:14:59 +08:00
|
|
|
|
|
|
|
extern size_t opt_hpa_sec_max_alloc;
|
|
|
|
extern size_t opt_hpa_sec_max_bytes;
|
|
|
|
extern size_t opt_hpa_sec_nshards;
|
|
|
|
|
2017-05-26 06:30:11 +08:00
|
|
|
extern const char *opt_junk;
|
|
|
|
extern bool opt_junk_alloc;
|
|
|
|
extern bool opt_junk_free;
|
2020-02-29 03:37:39 +08:00
|
|
|
extern void (*junk_free_callback)(void *ptr, size_t size);
|
|
|
|
extern void (*junk_alloc_callback)(void *ptr, size_t size);
|
2017-05-26 06:30:11 +08:00
|
|
|
extern bool opt_utrace;
|
|
|
|
extern bool opt_xmalloc;
|
|
|
|
extern bool opt_zero;
|
|
|
|
extern unsigned opt_narenas;
|
2019-09-24 08:56:19 +08:00
|
|
|
extern zero_realloc_action_t opt_zero_realloc_action;
|
|
|
|
extern const char *zero_realloc_mode_names[];
|
2019-10-27 02:04:46 +08:00
|
|
|
extern atomic_zu_t zero_realloc_count;
|
2017-04-11 09:17:55 +08:00
|
|
|
|
|
|
|
/* Number of CPUs. */
|
2017-05-26 06:30:11 +08:00
|
|
|
extern unsigned ncpus;
|
2017-04-11 09:17:55 +08:00
|
|
|
|
|
|
|
/* Number of arenas used for automatic multiplexing of threads and arenas. */
|
2017-05-26 06:30:11 +08:00
|
|
|
extern unsigned narenas_auto;
|
2017-04-11 09:17:55 +08:00
|
|
|
|
2018-06-02 06:06:36 +08:00
|
|
|
/* Base index for manual arenas. */
|
|
|
|
extern unsigned manual_arena_base;
|
|
|
|
|
2017-04-11 09:17:55 +08:00
|
|
|
/*
|
|
|
|
* Arenas that are used to service external requests. Not all elements of the
|
|
|
|
* arenas array are necessarily used; arenas are created lazily as needed.
|
|
|
|
*/
|
|
|
|
extern atomic_p_t arenas[];
|
|
|
|
|
|
|
|
void *a0malloc(size_t size);
|
|
|
|
void a0dalloc(void *ptr);
|
|
|
|
void *bootstrap_malloc(size_t size);
|
|
|
|
void *bootstrap_calloc(size_t num, size_t size);
|
|
|
|
void bootstrap_free(void *ptr);
|
|
|
|
void arena_set(unsigned ind, arena_t *arena);
|
|
|
|
unsigned narenas_total_get(void);
|
|
|
|
arena_t *arena_init(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks);
|
|
|
|
arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind);
|
|
|
|
arena_t *arena_choose_hard(tsd_t *tsd, bool internal);
|
|
|
|
void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind);
|
|
|
|
void iarena_cleanup(tsd_t *tsd);
|
|
|
|
void arena_cleanup(tsd_t *tsd);
|
|
|
|
void arenas_tdata_cleanup(tsd_t *tsd);
|
2020-04-24 06:46:45 +08:00
|
|
|
size_t batch_alloc(void **ptrs, size_t num, size_t size, int flags);
|
2017-04-11 09:17:55 +08:00
|
|
|
void jemalloc_prefork(void);
|
|
|
|
void jemalloc_postfork_parent(void);
|
|
|
|
void jemalloc_postfork_child(void);
|
|
|
|
bool malloc_initialized(void);
|
2019-03-09 03:50:30 +08:00
|
|
|
void je_sdallocx_noflags(void *ptr, size_t size);
|
2017-04-11 09:17:55 +08:00
|
|
|
|
|
|
|
#endif /* JEMALLOC_INTERNAL_EXTERNS_H */
|