10 #define JEMALLOC_VERSION "1.0.0-286-ga8f8d7540d66ddee7337db80c92890916e1063ca"
11 #define JEMALLOC_VERSION_MAJOR 1
12 #define JEMALLOC_VERSION_MINOR 0
13 #define JEMALLOC_VERSION_BUGFIX 0
14 #define JEMALLOC_VERSION_NREV 286
15 #define JEMALLOC_VERSION_GID "a8f8d7540d66ddee7337db80c92890916e1063ca"
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)
30 #define ALLOCM_SUCCESS 0
31 #define ALLOCM_ERR_OOM 1
32 #define ALLOCM_ERR_NOT_MOVED 2
36 * The je_ prefix on the following public symbol declarations is an artifact of
37 * namespace management, and should be omitted in application code unless
38 * JEMALLOC_NO_DEMANGLE is defined (see below).
40 extern const char *je_malloc_conf;
41 extern void (*je_malloc_message)(void *, const char *);
43 void *je_malloc(size_t size) JEMALLOC_ATTR(malloc);
44 void *je_calloc(size_t num, size_t size) JEMALLOC_ATTR(malloc);
45 int je_posix_memalign(void **memptr, size_t alignment, size_t size)
46 JEMALLOC_ATTR(nonnull(1));
47 void *je_aligned_alloc(size_t alignment, size_t size) JEMALLOC_ATTR(malloc);
48 void *je_realloc(void *ptr, size_t size);
49 void je_free(void *ptr);
51 size_t je_malloc_usable_size(const void *ptr);
52 void je_malloc_stats_print(void (*write_cb)(void *, const char *),
53 void *je_cbopaque, const char *opts);
54 int je_mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp,
56 int je_mallctlnametomib(const char *name, size_t *mibp, size_t *miblenp);
57 int je_mallctlbymib(const size_t *mib, size_t miblen, void *oldp,
58 size_t *oldlenp, void *newp, size_t newlen);
60 #ifdef JEMALLOC_EXPERIMENTAL
61 int je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
62 JEMALLOC_ATTR(nonnull(1));
63 int je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra,
64 int flags) JEMALLOC_ATTR(nonnull(1));
65 int je_sallocm(const void *ptr, size_t *rsize, int flags)
66 JEMALLOC_ATTR(nonnull(1));
67 int je_dallocm(void *ptr, int flags) JEMALLOC_ATTR(nonnull(1));
68 int je_nallocm(size_t *rsize, size_t size, int flags);
72 * By default application code must explicitly refer to mangled symbol names,
73 * so that it is possible to use jemalloc in conjunction with another allocator
74 * in the same application. Define JEMALLOC_MANGLE in order to cause automatic
75 * name mangling that matches the API prefixing that happened as a result of
76 * --with-mangling and/or --with-jemalloc-prefix configuration settings.
78 #ifdef JEMALLOC_MANGLE
79 #ifndef JEMALLOC_NO_DEMANGLE
80 #define JEMALLOC_NO_DEMANGLE
82 #define malloc_conf je_malloc_conf
83 #define malloc_message je_malloc_message
84 #define malloc je_malloc
85 #define calloc je_calloc
86 #define posix_memalign je_posix_memalign
87 #define aligned_alloc je_aligned_alloc
88 #define realloc je_realloc
90 #define malloc_usable_size je_malloc_usable_size
91 #define malloc_stats_print je_malloc_stats_print
92 #define mallctl je_mallctl
93 #define mallctlnametomib je_mallctlnametomib
94 #define mallctlbymib je_mallctlbymib
95 #define memalign je_memalign
96 #define valloc je_valloc
97 #ifdef JEMALLOC_EXPERIMENTAL
98 #define allocm je_allocm
99 #define rallocm je_rallocm
100 #define sallocm je_sallocm
101 #define dallocm je_dallocm
102 #define nallocm je_nallocm
107 * The je_* macros can be used as stable alternative names for the public
108 * jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily meant
109 * for use in jemalloc itself, but it can be used by application code to
110 * provide isolation from the name mangling specified via --with-mangling
111 * and/or --with-jemalloc-prefix.
113 #ifndef JEMALLOC_NO_DEMANGLE
114 #undef je_malloc_conf
115 #undef je_malloc_message
118 #undef je_posix_memalign
119 #undef je_aligned_alloc
122 #undef je_malloc_usable_size
123 #undef je_malloc_stats_print
125 #undef je_mallctlnametomib
126 #undef je_mallctlbymib
129 #ifdef JEMALLOC_EXPERIMENTAL
141 #endif /* JEMALLOC_H_ */