1234370Sjasone/******************************************************************************/ 2234370Sjasone#ifdef JEMALLOC_H_TYPES 3234370Sjasone 4234370Sjasone/* 5234370Sjasone * Size and alignment of memory chunks that are allocated by the OS's virtual 6234370Sjasone * memory system. 7234370Sjasone */ 8234370Sjasone#define LG_CHUNK_DEFAULT 22 9234370Sjasone 10234370Sjasone/* Return the chunk address for allocation address a. */ 11234370Sjasone#define CHUNK_ADDR2BASE(a) \ 12234370Sjasone ((void *)((uintptr_t)(a) & ~chunksize_mask)) 13234370Sjasone 14234370Sjasone/* Return the chunk offset of address a. */ 15234370Sjasone#define CHUNK_ADDR2OFFSET(a) \ 16234370Sjasone ((size_t)((uintptr_t)(a) & chunksize_mask)) 17234370Sjasone 18234370Sjasone/* Return the smallest chunk multiple that is >= s. */ 19234370Sjasone#define CHUNK_CEILING(s) \ 20234370Sjasone (((s) + chunksize_mask) & ~chunksize_mask) 21234370Sjasone 22234370Sjasone#endif /* JEMALLOC_H_TYPES */ 23234370Sjasone/******************************************************************************/ 24234370Sjasone#ifdef JEMALLOC_H_STRUCTS 25234370Sjasone 26234370Sjasone#endif /* JEMALLOC_H_STRUCTS */ 27234370Sjasone/******************************************************************************/ 28234370Sjasone#ifdef JEMALLOC_H_EXTERNS 29234370Sjasone 30234370Sjasoneextern size_t opt_lg_chunk; 31242844Sjasoneextern const char *opt_dss; 32234370Sjasone 33234370Sjasone/* Protects stats_chunks; currently not used for any other purpose. */ 34234370Sjasoneextern malloc_mutex_t chunks_mtx; 35234370Sjasone/* Chunk statistics. */ 36234370Sjasoneextern chunk_stats_t stats_chunks; 37234370Sjasone 38234370Sjasoneextern rtree_t *chunks_rtree; 39234370Sjasone 40234370Sjasoneextern size_t chunksize; 41234370Sjasoneextern size_t chunksize_mask; /* (chunksize - 1). */ 42234370Sjasoneextern size_t chunk_npages; 43234370Sjasoneextern size_t map_bias; /* Number of arena chunk header pages. */ 44234370Sjasoneextern size_t arena_maxclass; /* Max size class for arenas. */ 45234370Sjasone 46242844Sjasonevoid *chunk_alloc(size_t size, size_t alignment, bool base, bool *zero, 47242844Sjasone dss_prec_t dss_prec); 48242844Sjasonevoid chunk_unmap(void *chunk, size_t size); 49234370Sjasonevoid chunk_dealloc(void *chunk, size_t size, bool unmap); 50234569Sjasonebool chunk_boot(void); 51242844Sjasonevoid chunk_prefork(void); 52242844Sjasonevoid chunk_postfork_parent(void); 53242844Sjasonevoid chunk_postfork_child(void); 54234370Sjasone 55234370Sjasone#endif /* JEMALLOC_H_EXTERNS */ 56234370Sjasone/******************************************************************************/ 57234370Sjasone#ifdef JEMALLOC_H_INLINES 58234370Sjasone 59234370Sjasone#endif /* JEMALLOC_H_INLINES */ 60234370Sjasone/******************************************************************************/ 61234370Sjasone 62234370Sjasone#include "jemalloc/internal/chunk_dss.h" 63234370Sjasone#include "jemalloc/internal/chunk_mmap.h" 64