]> git.saurik.com Git - redis.git/blob - deps/jemalloc/include/jemalloc/internal/chunk.h
54b6a3ec886780587efa2a0d81d326d4ebf93ad9
[redis.git] / deps / jemalloc / include / jemalloc / internal / chunk.h
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
30 extern size_t opt_lg_chunk;
31 #ifdef JEMALLOC_SWAP
32 extern bool opt_overcommit;
33 #endif
34
35 #if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF))
36 /* Protects stats_chunks; currently not used for any other purpose. */
37 extern malloc_mutex_t chunks_mtx;
38 /* Chunk statistics. */
39 extern chunk_stats_t stats_chunks;
40 #endif
41
42 #ifdef JEMALLOC_IVSALLOC
43 extern rtree_t *chunks_rtree;
44 #endif
45
46 extern size_t chunksize;
47 extern size_t chunksize_mask; /* (chunksize - 1). */
48 extern size_t chunk_npages;
49 extern size_t map_bias; /* Number of arena chunk header pages. */
50 extern size_t arena_maxclass; /* Max size class for arenas. */
51
52 void *chunk_alloc(size_t size, bool base, bool *zero);
53 void chunk_dealloc(void *chunk, size_t size, bool unmap);
54 bool chunk_boot(void);
55
56 #endif /* JEMALLOC_H_EXTERNS */
57 /******************************************************************************/
58 #ifdef JEMALLOC_H_INLINES
59
60 #endif /* JEMALLOC_H_INLINES */
61 /******************************************************************************/
62
63 #include "jemalloc/internal/chunk_swap.h"
64 #include "jemalloc/internal/chunk_dss.h"
65 #include "jemalloc/internal/chunk_mmap.h"