mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
e522aa3a07
- ASAN memory morgue is now lockless - Make C11 atomics header more portable - Rewrote pthread keys support to be lockless - Simplify Python's unicode table unpacking code - Make crash report write(2) closer to being atomic - Make it possible to strace/ftrace a single thread - ASAN now checks nul-terminated strings fast and properly - Windows fork() now restores TLS memory of calling thread
35 lines
891 B
C++
35 lines
891 B
C++
// clang-format off
|
|
|
|
/* ------------- Global malloc_state and malloc_params ------------------- */
|
|
|
|
/*
|
|
malloc_params holds global properties, including those that can be
|
|
dynamically set using mallopt. There is a single instance, mparams,
|
|
initialized in init_mparams. Note that the non-zeroness of "magic"
|
|
also serves as an initialization flag.
|
|
*/
|
|
|
|
struct malloc_params {
|
|
size_t magic;
|
|
size_t page_size;
|
|
size_t granularity;
|
|
size_t mmap_threshold;
|
|
size_t trim_threshold;
|
|
flag_t default_mflags;
|
|
};
|
|
|
|
static struct malloc_params mparams;
|
|
|
|
/* Ensure mparams initialized */
|
|
#define ensure_initialization() (void)0
|
|
|
|
#if !ONLY_MSPACES
|
|
|
|
/* The global malloc_state used for all non-"mspace" calls */
|
|
static struct malloc_state _gm_;
|
|
#define gm (&_gm_)
|
|
#define is_global(M) ((M) == &_gm_)
|
|
|
|
#endif /* !ONLY_MSPACES */
|
|
|
|
#define is_initialized(M) ((M)->top != 0)
|