10 #define JEMALLOC_VERSION "3.4.1-0-g0135fb806e4137dc9cdf152541926a2bc95e33f0"
11 #define JEMALLOC_VERSION_MAJOR 3
12 #define JEMALLOC_VERSION_MINOR 4
13 #define JEMALLOC_VERSION_BUGFIX 1
14 #define JEMALLOC_VERSION_NREV 0
15 #define JEMALLOC_VERSION_GID "0135fb806e4137dc9cdf152541926a2bc95e33f0"
17 #include "jemalloc_defs.h"
18 #include "jemalloc_FreeBSD.h"
20 #ifdef JEMALLOC_EXPERIMENTAL
21 #define ALLOCM_LG_ALIGN(la) (la)
22 #if LG_SIZEOF_PTR == 2
23 #define ALLOCM_ALIGN(a) (ffs(a)-1)
25 #define ALLOCM_ALIGN(a) ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31)
27 #define ALLOCM_ZERO ((int)0x40)
28 #define ALLOCM_NO_MOVE ((int)0x80)
29 /* Bias arena index bits so that 0 encodes "ALLOCM_ARENA() unspecified". */
30 #define ALLOCM_ARENA(a) ((int)(((a)+1) << 8))
32 #define ALLOCM_SUCCESS 0
33 #define ALLOCM_ERR_OOM 1
34 #define ALLOCM_ERR_NOT_MOVED 2
38 * The je_ prefix on the following public symbol declarations is an artifact of
39 * namespace management, and should be omitted in application code unless
40 * JEMALLOC_NO_DEMANGLE is defined (see below).
42 extern JEMALLOC_EXPORT const char *je_malloc_conf;
43 extern JEMALLOC_EXPORT void (*je_malloc_message)(void *cbopaque,
46 JEMALLOC_EXPORT void *je_malloc(size_t size) JEMALLOC_ATTR(malloc);
47 JEMALLOC_EXPORT void *je_calloc(size_t num, size_t size)
48 JEMALLOC_ATTR(malloc);
49 JEMALLOC_EXPORT int je_posix_memalign(void **memptr, size_t alignment,
50 size_t size) JEMALLOC_ATTR(nonnull(1));
51 JEMALLOC_EXPORT void *je_aligned_alloc(size_t alignment, size_t size)
52 JEMALLOC_ATTR(malloc);
53 JEMALLOC_EXPORT void *je_realloc(void *ptr, size_t size);
54 JEMALLOC_EXPORT void je_free(void *ptr);
56 #ifdef JEMALLOC_OVERRIDE_MEMALIGN
57 JEMALLOC_EXPORT void * je_memalign(size_t alignment, size_t size)
58 JEMALLOC_ATTR(malloc);
61 #ifdef JEMALLOC_OVERRIDE_VALLOC
62 JEMALLOC_EXPORT void * je_valloc(size_t size) JEMALLOC_ATTR(malloc);
65 JEMALLOC_EXPORT size_t je_malloc_usable_size(
66 JEMALLOC_USABLE_SIZE_CONST void *ptr);
67 JEMALLOC_EXPORT void je_malloc_stats_print(void (*write_cb)(void *,
68 const char *), void *je_cbopaque, const char *opts);
69 JEMALLOC_EXPORT int je_mallctl(const char *name, void *oldp,
70 size_t *oldlenp, void *newp, size_t newlen);
71 JEMALLOC_EXPORT int je_mallctlnametomib(const char *name, size_t *mibp,
73 JEMALLOC_EXPORT int je_mallctlbymib(const size_t *mib, size_t miblen,
74 void *oldp, size_t *oldlenp, void *newp, size_t newlen);
76 #ifdef JEMALLOC_EXPERIMENTAL
77 JEMALLOC_EXPORT int je_allocm(void **ptr, size_t *rsize, size_t size,
78 int flags) JEMALLOC_ATTR(nonnull(1));
79 JEMALLOC_EXPORT int je_rallocm(void **ptr, size_t *rsize, size_t size,
80 size_t extra, int flags) JEMALLOC_ATTR(nonnull(1));
81 JEMALLOC_EXPORT int je_sallocm(const void *ptr, size_t *rsize, int flags)
82 JEMALLOC_ATTR(nonnull(1));
83 JEMALLOC_EXPORT int je_dallocm(void *ptr, int flags)
84 JEMALLOC_ATTR(nonnull(1));
85 JEMALLOC_EXPORT int je_nallocm(size_t *rsize, size_t size, int flags);
89 * By default application code must explicitly refer to mangled symbol names,
90 * so that it is possible to use jemalloc in conjunction with another allocator
91 * in the same application. Define JEMALLOC_MANGLE in order to cause automatic
92 * name mangling that matches the API prefixing that happened as a result of
93 * --with-mangling and/or --with-jemalloc-prefix configuration settings.
95 #ifdef JEMALLOC_MANGLE
96 #ifndef JEMALLOC_NO_DEMANGLE
97 #define JEMALLOC_NO_DEMANGLE
99 #define malloc_conf je_malloc_conf
100 #define malloc_message je_malloc_message
101 #define malloc je_malloc
102 #define calloc je_calloc
103 #define posix_memalign je_posix_memalign
104 #define aligned_alloc je_aligned_alloc
105 #define realloc je_realloc
107 #define malloc_usable_size je_malloc_usable_size
108 #define malloc_stats_print je_malloc_stats_print
109 #define mallctl je_mallctl
110 #define mallctlnametomib je_mallctlnametomib
111 #define mallctlbymib je_mallctlbymib
112 #define memalign je_memalign
113 #define valloc je_valloc
114 #ifdef JEMALLOC_EXPERIMENTAL
115 #define allocm je_allocm
116 #define rallocm je_rallocm
117 #define sallocm je_sallocm
118 #define dallocm je_dallocm
119 #define nallocm je_nallocm
124 * The je_* macros can be used as stable alternative names for the public
125 * jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily meant
126 * for use in jemalloc itself, but it can be used by application code to
127 * provide isolation from the name mangling specified via --with-mangling
128 * and/or --with-jemalloc-prefix.
130 #ifndef JEMALLOC_NO_DEMANGLE
131 #undef je_malloc_conf
132 #undef je_malloc_message
135 #undef je_posix_memalign
136 #undef je_aligned_alloc
139 #undef je_malloc_usable_size
140 #undef je_malloc_stats_print
142 #undef je_mallctlnametomib
143 #undef je_mallctlbymib
146 #ifdef JEMALLOC_EXPERIMENTAL
158 #endif /* JEMALLOC_H_ */