TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
chunk.h
Go to the documentation of this file.
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 extern const char *opt_dss;
32 
33 /* Protects stats_chunks; currently not used for any other purpose. */
34 extern malloc_mutex_t chunks_mtx;
35 /* Chunk statistics. */
36 extern chunk_stats_t stats_chunks;
37 
38 extern rtree_t *chunks_rtree;
39 
40 extern size_t chunksize;
41 extern size_t chunksize_mask; /* (chunksize - 1). */
42 extern size_t chunk_npages;
43 extern size_t map_bias; /* Number of arena chunk header pages. */
44 extern size_t arena_maxclass; /* Max size class for arenas. */
45 
46 void *chunk_alloc(size_t size, size_t alignment, bool base, bool *zero,
47  dss_prec_t dss_prec);
48 void chunk_unmap(void *chunk, size_t size);
49 void chunk_dealloc(void *chunk, size_t size, bool unmap);
50 bool chunk_boot(void);
51 void chunk_prefork(void);
52 void chunk_postfork_parent(void);
53 void chunk_postfork_child(void);
54 
55 #endif /* JEMALLOC_H_EXTERNS */
56 /******************************************************************************/
57 #ifdef JEMALLOC_H_INLINES
58 
59 #endif /* JEMALLOC_H_INLINES */
60 /******************************************************************************/
61 
#define opt_lg_chunk
Definition: private_namespace.h:264
#define chunk_unmap
Definition: private_namespace.h:123
#define chunksize_mask
Definition: private_namespace.h:127
#define chunksize
Definition: private_namespace.h:126
#define chunk_alloc
Definition: private_namespace.h:106
#define arena_maxclass
Definition: private_namespace.h:40
Definition: adtfile.h:57
#define chunk_postfork_parent
Definition: private_namespace.h:121
#define chunk_boot
Definition: private_namespace.h:109
#define chunk_dealloc
Definition: private_namespace.h:110
#define map_bias
Definition: private_namespace.h:253
#define stats_chunks
Definition: private_namespace.h:354
#define chunks_mtx
Definition: private_namespace.h:124
#define chunks_rtree
Definition: private_namespace.h:125
#define opt_dss
Definition: private_namespace.h:262
static unorm16 zero()
Definition: unorm16.h:82
#define chunk_postfork_child
Definition: private_namespace.h:120
#define chunk_prefork
Definition: private_namespace.h:122
#define chunk_npages
Definition: private_namespace.h:119