]>
git.saurik.com Git - redis.git/blob - deps/jemalloc/include/jemalloc/jemalloc.h.in
ad0694858da10632c43c43e17bb59833ffa054af
10 #define JEMALLOC_VERSION "@jemalloc_version@"
11 #define JEMALLOC_VERSION_MAJOR @jemalloc_version_major@
12 #define JEMALLOC_VERSION_MINOR @jemalloc_version_minor@
13 #define JEMALLOC_VERSION_BUGFIX @jemalloc_version_bugfix@
14 #define JEMALLOC_VERSION_NREV @jemalloc_version_nrev@
15 #define JEMALLOC_VERSION_GID "@jemalloc_version_gid@"
17 #include "jemalloc_defs@install_suffix@.h"
19 #ifdef JEMALLOC_EXPERIMENTAL
20 #define ALLOCM_LG_ALIGN(la) (la)
21 #if LG_SIZEOF_PTR == 2
22 #define ALLOCM_ALIGN(a) (ffs(a)-1)
24 #define ALLOCM_ALIGN(a) ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31)
26 #define ALLOCM_ZERO ((int)0x40)
27 #define ALLOCM_NO_MOVE ((int)0x80)
29 #define ALLOCM_SUCCESS 0
30 #define ALLOCM_ERR_OOM 1
31 #define ALLOCM_ERR_NOT_MOVED 2
35 * The je_ prefix on the following public symbol declarations is an artifact of
36 * namespace management, and should be omitted in application code unless
37 * JEMALLOC_NO_DEMANGLE is defined (see below).
39 extern JEMALLOC_EXPORT
const char *je_malloc_conf
;
40 extern JEMALLOC_EXPORT
void (*je_malloc_message
)(void *cbopaque
,
43 JEMALLOC_EXPORT
void *je_malloc(size_t size
) JEMALLOC_ATTR(malloc
);
44 JEMALLOC_EXPORT
void *je_calloc(size_t num
, size_t size
)
45 JEMALLOC_ATTR(malloc
);
46 JEMALLOC_EXPORT
int je_posix_memalign(void **memptr
, size_t alignment
,
47 size_t size
) JEMALLOC_ATTR(nonnull(1));
48 JEMALLOC_EXPORT
void *je_aligned_alloc(size_t alignment
, size_t size
)
49 JEMALLOC_ATTR(malloc
);
50 JEMALLOC_EXPORT
void *je_realloc(void *ptr
, size_t size
);
51 JEMALLOC_EXPORT
void je_free(void *ptr
);
53 #ifdef JEMALLOC_OVERRIDE_MEMALIGN
54 JEMALLOC_EXPORT
void * je_memalign(size_t alignment
, size_t size
)
55 JEMALLOC_ATTR(malloc
);
58 #ifdef JEMALLOC_OVERRIDE_VALLOC
59 JEMALLOC_EXPORT
void * je_valloc(size_t size
) JEMALLOC_ATTR(malloc
);
62 JEMALLOC_EXPORT
size_t je_malloc_usable_size(const void *ptr
);
63 JEMALLOC_EXPORT
void je_malloc_stats_print(void (*write_cb
)(void *,
64 const char *), void *je_cbopaque
, const char *opts
);
65 JEMALLOC_EXPORT
int je_mallctl(const char *name
, void *oldp
,
66 size_t *oldlenp
, void *newp
, size_t newlen
);
67 JEMALLOC_EXPORT
int je_mallctlnametomib(const char *name
, size_t *mibp
,
69 JEMALLOC_EXPORT
int je_mallctlbymib(const size_t *mib
, size_t miblen
,
70 void *oldp
, size_t *oldlenp
, void *newp
, size_t newlen
);
72 #ifdef JEMALLOC_EXPERIMENTAL
73 JEMALLOC_EXPORT
int je_allocm(void **ptr
, size_t *rsize
, size_t size
,
74 int flags
) JEMALLOC_ATTR(nonnull(1));
75 JEMALLOC_EXPORT
int je_rallocm(void **ptr
, size_t *rsize
, size_t size
,
76 size_t extra
, int flags
) JEMALLOC_ATTR(nonnull(1));
77 JEMALLOC_EXPORT
int je_sallocm(const void *ptr
, size_t *rsize
, int flags
)
78 JEMALLOC_ATTR(nonnull(1));
79 JEMALLOC_EXPORT
int je_dallocm(void *ptr
, int flags
)
80 JEMALLOC_ATTR(nonnull(1));
81 JEMALLOC_EXPORT
int je_nallocm(size_t *rsize
, size_t size
, int flags
);
85 * By default application code must explicitly refer to mangled symbol names,
86 * so that it is possible to use jemalloc in conjunction with another allocator
87 * in the same application. Define JEMALLOC_MANGLE in order to cause automatic
88 * name mangling that matches the API prefixing that happened as a result of
89 * --with-mangling and/or --with-jemalloc-prefix configuration settings.
91 #ifdef JEMALLOC_MANGLE
92 #ifndef JEMALLOC_NO_DEMANGLE
93 #define JEMALLOC_NO_DEMANGLE
95 #define malloc_conf je_malloc_conf
96 #define malloc_message je_malloc_message
97 #define malloc je_malloc
98 #define calloc je_calloc
99 #define posix_memalign je_posix_memalign
100 #define aligned_alloc je_aligned_alloc
101 #define realloc je_realloc
103 #define malloc_usable_size je_malloc_usable_size
104 #define malloc_stats_print je_malloc_stats_print
105 #define mallctl je_mallctl
106 #define mallctlnametomib je_mallctlnametomib
107 #define mallctlbymib je_mallctlbymib
108 #define memalign je_memalign
109 #define valloc je_valloc
110 #ifdef JEMALLOC_EXPERIMENTAL
111 #define allocm je_allocm
112 #define rallocm je_rallocm
113 #define sallocm je_sallocm
114 #define dallocm je_dallocm
115 #define nallocm je_nallocm
120 * The je_* macros can be used as stable alternative names for the public
121 * jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily meant
122 * for use in jemalloc itself, but it can be used by application code to
123 * provide isolation from the name mangling specified via --with-mangling
124 * and/or --with-jemalloc-prefix.
126 #ifndef JEMALLOC_NO_DEMANGLE
127 #undef je_malloc_conf
128 #undef je_malloc_message
131 #undef je_posix_memalign
132 #undef je_aligned_alloc
135 #undef je_malloc_usable_size
136 #undef je_malloc_stats_print
138 #undef je_mallctlnametomib
139 #undef je_mallctlbymib
142 #ifdef JEMALLOC_EXPERIMENTAL
154 #endif /* JEMALLOC_H_ */