chunk.h revision a8f8d7540d66ddee7337db80c92890916e1063ca
1/******************************************************************************/ 2#ifdef JEMALLOC_H_TYPES 3 4/* 5 * Size and alignment of memory chunks that are allocated by the OS's virtual 6 * memory system. 7 */ 8#define LG_CHUNK_DEFAULT 22 9 10/* Return the chunk address for allocation address a. */ 11#define CHUNK_ADDR2BASE(a) \ 12 ((void *)((uintptr_t)(a) & ~chunksize_mask)) 13 14/* Return the chunk offset of address a. */ 15#define CHUNK_ADDR2OFFSET(a) \ 16 ((size_t)((uintptr_t)(a) & chunksize_mask)) 17 18/* Return the smallest chunk multiple that is >= s. */ 19#define CHUNK_CEILING(s) \ 20 (((s) + chunksize_mask) & ~chunksize_mask) 21 22#endif /* JEMALLOC_H_TYPES */ 23/******************************************************************************/ 24#ifdef JEMALLOC_H_STRUCTS 25 26#endif /* JEMALLOC_H_STRUCTS */ 27/******************************************************************************/ 28#ifdef JEMALLOC_H_EXTERNS 29 30extern size_t opt_lg_chunk; 31 32/* Protects stats_chunks; currently not used for any other purpose. */ 33extern malloc_mutex_t chunks_mtx; 34/* Chunk statistics. */ 35extern chunk_stats_t stats_chunks; 36 37extern rtree_t *chunks_rtree; 38 39extern size_t chunksize; 40extern size_t chunksize_mask; /* (chunksize - 1). */ 41extern size_t chunk_npages; 42extern size_t map_bias; /* Number of arena chunk header pages. */ 43extern size_t arena_maxclass; /* Max size class for arenas. */ 44 45void *chunk_alloc(size_t size, size_t alignment, bool base, bool *zero); 46void chunk_dealloc(void *chunk, size_t size, bool unmap); 47bool chunk_boot(void); 48 49#endif /* JEMALLOC_H_EXTERNS */ 50/******************************************************************************/ 51#ifdef JEMALLOC_H_INLINES 52 53#endif /* JEMALLOC_H_INLINES */ 54/******************************************************************************/ 55 56#include "jemalloc/internal/chunk_dss.h" 57#include "jemalloc/internal/chunk_mmap.h" 58