TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
jemalloc.h
Go to the documentation of this file.
1 #ifndef JEMALLOC_H_
2 #define JEMALLOC_H_
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 #include <limits.h>
8 #include <strings.h>
9 
10 #define JEMALLOC_VERSION "3.6.0-0-g46c0af68bd248b04df75e4f92d5fb804c3d75340"
11 #define JEMALLOC_VERSION_MAJOR 3
12 #define JEMALLOC_VERSION_MINOR 6
13 #define JEMALLOC_VERSION_BUGFIX 0
14 #define JEMALLOC_VERSION_NREV 0
15 #define JEMALLOC_VERSION_GID "46c0af68bd248b04df75e4f92d5fb804c3d75340"
16 
17 # define MALLOCX_LG_ALIGN(la) (la)
18 # if LG_SIZEOF_PTR == 2
19 # define MALLOCX_ALIGN(a) (ffs(a)-1)
20 # else
21 # define MALLOCX_ALIGN(a) \
22  ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31)
23 # endif
24 # define MALLOCX_ZERO ((int)0x40)
25 /* Bias arena index bits so that 0 encodes "MALLOCX_ARENA() unspecified". */
26 # define MALLOCX_ARENA(a) ((int)(((a)+1) << 8))
27 
28 #ifdef JEMALLOC_EXPERIMENTAL
29 # define ALLOCM_LG_ALIGN(la) (la)
30 # if LG_SIZEOF_PTR == 2
31 # define ALLOCM_ALIGN(a) (ffs(a)-1)
32 # else
33 # define ALLOCM_ALIGN(a) \
34  ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31)
35 # endif
36 # define ALLOCM_ZERO ((int)0x40)
37 # define ALLOCM_NO_MOVE ((int)0x80)
38 /* Bias arena index bits so that 0 encodes "ALLOCM_ARENA() unspecified". */
39 # define ALLOCM_ARENA(a) ((int)(((a)+1) << 8))
40 # define ALLOCM_SUCCESS 0
41 # define ALLOCM_ERR_OOM 1
42 # define ALLOCM_ERR_NOT_MOVED 2
43 #endif
44 
45 /*
46  * The je_ prefix on the following public symbol declarations is an artifact
47  * of namespace management, and should be omitted in application code unless
48  * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle.h).
49  */
50 extern JEMALLOC_EXPORT const char *je_malloc_conf;
51 extern JEMALLOC_EXPORT void (*je_malloc_message)(void *cbopaque,
52  const char *s);
53 
54 JEMALLOC_EXPORT void *je_malloc(size_t size) JEMALLOC_ATTR(malloc);
55 JEMALLOC_EXPORT void *je_calloc(size_t num, size_t size)
56  JEMALLOC_ATTR(malloc);
57 JEMALLOC_EXPORT int je_posix_memalign(void **memptr, size_t alignment,
58  size_t size) JEMALLOC_ATTR(nonnull(1));
59 JEMALLOC_EXPORT void *je_aligned_alloc(size_t alignment, size_t size)
60  JEMALLOC_ATTR(malloc);
61 JEMALLOC_EXPORT void *je_realloc(void *ptr, size_t size);
62 JEMALLOC_EXPORT void je_free(void *ptr);
63 
64 JEMALLOC_EXPORT void *je_mallocx(size_t size, int flags);
65 JEMALLOC_EXPORT void *je_rallocx(void *ptr, size_t size, int flags);
66 JEMALLOC_EXPORT size_t je_xallocx(void *ptr, size_t size, size_t extra,
67  int flags);
68 JEMALLOC_EXPORT size_t je_sallocx(const void *ptr, int flags);
69 JEMALLOC_EXPORT void je_dallocx(void *ptr, int flags);
70 JEMALLOC_EXPORT size_t je_nallocx(size_t size, int flags);
71 
72 JEMALLOC_EXPORT int je_mallctl(const char *name, void *oldp,
73  size_t *oldlenp, void *newp, size_t newlen);
74 JEMALLOC_EXPORT int je_mallctlnametomib(const char *name, size_t *mibp,
75  size_t *miblenp);
76 JEMALLOC_EXPORT int je_mallctlbymib(const size_t *mib, size_t miblen,
77  void *oldp, size_t *oldlenp, void *newp, size_t newlen);
78 JEMALLOC_EXPORT void je_malloc_stats_print(void (*write_cb)(void *,
79  const char *), void *je_cbopaque, const char *opts);
80 JEMALLOC_EXPORT size_t je_malloc_usable_size(
81  JEMALLOC_USABLE_SIZE_CONST void *ptr);
82 
83 #ifdef JEMALLOC_OVERRIDE_MEMALIGN
84 JEMALLOC_EXPORT void * je_memalign(size_t alignment, size_t size)
85  JEMALLOC_ATTR(malloc);
86 #endif
87 
88 #ifdef JEMALLOC_OVERRIDE_VALLOC
89 JEMALLOC_EXPORT void * je_valloc(size_t size) JEMALLOC_ATTR(malloc);
90 #endif
91 
92 #ifdef JEMALLOC_EXPERIMENTAL
93 JEMALLOC_EXPORT int je_allocm(void **ptr, size_t *rsize, size_t size,
94  int flags) JEMALLOC_ATTR(nonnull(1));
95 JEMALLOC_EXPORT int je_rallocm(void **ptr, size_t *rsize, size_t size,
96  size_t extra, int flags) JEMALLOC_ATTR(nonnull(1));
97 JEMALLOC_EXPORT int je_sallocm(const void *ptr, size_t *rsize, int flags)
98  JEMALLOC_ATTR(nonnull(1));
99 JEMALLOC_EXPORT int je_dallocm(void *ptr, int flags)
100  JEMALLOC_ATTR(nonnull(1));
101 JEMALLOC_EXPORT int je_nallocm(size_t *rsize, size_t size, int flags);
102 #endif
103 
104 /*
105  * By default application code must explicitly refer to mangled symbol names,
106  * so that it is possible to use jemalloc in conjunction with another allocator
107  * in the same application. Define JEMALLOC_MANGLE in order to cause automatic
108  * name mangling that matches the API prefixing that happened as a result of
109  * --with-mangling and/or --with-jemalloc-prefix configuration settings.
110  */
111 #ifdef JEMALLOC_MANGLE
112 # ifndef JEMALLOC_NO_DEMANGLE
113 # define JEMALLOC_NO_DEMANGLE
114 # endif
115 # define malloc_conf je_malloc_conf
116 # define malloc_message je_malloc_message
117 # define malloc je_malloc
118 # define calloc je_calloc
119 # define posix_memalign je_posix_memalign
120 # define aligned_alloc je_aligned_alloc
121 # define realloc je_realloc
122 # define free je_free
123 # define mallocx je_mallocx
124 # define rallocx je_rallocx
125 # define xallocx je_xallocx
126 # define sallocx je_sallocx
127 # define dallocx je_dallocx
128 # define nallocx je_nallocx
129 # define mallctl je_mallctl
130 # define mallctlnametomib je_mallctlnametomib
131 # define mallctlbymib je_mallctlbymib
132 # define malloc_stats_print je_malloc_stats_print
133 # define malloc_usable_size je_malloc_usable_size
134 # define memalign je_memalign
135 # define valloc je_valloc
136 # define allocm je_allocm
137 # define dallocm je_dallocm
138 # define nallocm je_nallocm
139 # define rallocm je_rallocm
140 # define sallocm je_sallocm
141 #endif
142 
143 /*
144  * The je_* macros can be used as stable alternative names for the
145  * public jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily
146  * meant for use in jemalloc itself, but it can be used by application code to
147  * provide isolation from the name mangling specified via --with-mangling
148  * and/or --with-jemalloc-prefix.
149  */
150 #ifndef JEMALLOC_NO_DEMANGLE
151 # undef je_malloc_conf
152 # undef je_malloc_message
153 # undef je_malloc
154 # undef je_calloc
155 # undef je_posix_memalign
156 # undef je_aligned_alloc
157 # undef je_realloc
158 # undef je_free
159 # undef je_mallocx
160 # undef je_rallocx
161 # undef je_xallocx
162 # undef je_sallocx
163 # undef je_dallocx
164 # undef je_nallocx
165 # undef je_mallctl
166 # undef je_mallctlnametomib
167 # undef je_mallctlbymib
168 # undef je_malloc_stats_print
169 # undef je_malloc_usable_size
170 # undef je_memalign
171 # undef je_valloc
172 # undef je_allocm
173 # undef je_dallocm
174 # undef je_nallocm
175 # undef je_rallocm
176 # undef je_sallocm
177 #endif
178 
179 #ifdef __cplusplus
180 };
181 #endif
182 #endif /* JEMALLOC_H_ */
JEMALLOC_EXPORT const char * je_malloc_conf
JEMALLOC_EXPORT size_t je_nallocx(size_t size, int flags)
JEMALLOC_EXPORT void * je_mallocx(size_t size, int flags)
JEMALLOC_EXPORT int je_posix_memalign(void **memptr, size_t alignment, size_t size) JEMALLOC_ATTR(nonnull(1))
JEMALLOC_EXPORT int je_mallctlnametomib(const char *name, size_t *mibp, size_t *miblenp)
JEMALLOC_EXPORT int je_mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
JEMALLOC_EXPORT void je_dallocx(void *ptr, int flags)
JEMALLOC_EXPORT void je_malloc_stats_print(void(*write_cb)(void *, const char *), void *je_cbopaque, const char *opts)
JEMALLOC_EXPORT void * je_aligned_alloc(size_t alignment, size_t size) JEMALLOC_ATTR(malloc)
JEMALLOC_EXPORT int je_mallctlbymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
JEMALLOC_EXPORT size_t je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr)
JEMALLOC_EXPORT void je_free(void *ptr)
JEMALLOC_EXPORT void * je_rallocx(void *ptr, size_t size, int flags)
JEMALLOC_EXPORT size_t je_xallocx(void *ptr, size_t size, size_t extra, int flags)
JEMALLOC_EXPORT void * je_realloc(void *ptr, size_t size)
JEMALLOC_EXPORT size_t je_sallocx(const void *ptr, int flags)
JEMALLOC_EXPORT void * je_calloc(size_t num, size_t size) JEMALLOC_ATTR(malloc)
JEMALLOC_EXPORT void(* je_malloc_message)(void *cbopaque, const char *s)
uint8 flags
Definition: DisableMgr.cpp:44
JEMALLOC_EXPORT void * je_malloc(size_t size) JEMALLOC_ATTR(malloc)