]>
Commit | Line | Data |
---|---|---|
4934f93d | 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 "@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@" | |
16 | ||
17 | #include "jemalloc_defs@install_suffix@.h" | |
18 | #ifndef JEMALLOC_P | |
19 | # define JEMALLOC_P(s) s | |
20 | #endif | |
21 | ||
22 | #define ALLOCM_LG_ALIGN(la) (la) | |
23 | #if LG_SIZEOF_PTR == 2 | |
24 | #define ALLOCM_ALIGN(a) (ffs(a)-1) | |
25 | #else | |
26 | #define ALLOCM_ALIGN(a) ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31) | |
27 | #endif | |
28 | #define ALLOCM_ZERO ((int)0x40) | |
29 | #define ALLOCM_NO_MOVE ((int)0x80) | |
30 | ||
31 | #define ALLOCM_SUCCESS 0 | |
32 | #define ALLOCM_ERR_OOM 1 | |
33 | #define ALLOCM_ERR_NOT_MOVED 2 | |
34 | ||
35 | extern const char *JEMALLOC_P(malloc_conf); | |
36 | extern void (*JEMALLOC_P(malloc_message))(void *, const char *); | |
37 | ||
38 | void *JEMALLOC_P(malloc)(size_t size) JEMALLOC_ATTR(malloc); | |
39 | void *JEMALLOC_P(calloc)(size_t num, size_t size) JEMALLOC_ATTR(malloc); | |
40 | int JEMALLOC_P(posix_memalign)(void **memptr, size_t alignment, size_t size) | |
41 | JEMALLOC_ATTR(nonnull(1)); | |
42 | void *JEMALLOC_P(realloc)(void *ptr, size_t size); | |
43 | void JEMALLOC_P(free)(void *ptr); | |
44 | ||
45 | size_t JEMALLOC_P(malloc_usable_size)(const void *ptr); | |
46 | void JEMALLOC_P(malloc_stats_print)(void (*write_cb)(void *, const char *), | |
47 | void *cbopaque, const char *opts); | |
48 | int JEMALLOC_P(mallctl)(const char *name, void *oldp, size_t *oldlenp, | |
49 | void *newp, size_t newlen); | |
50 | int JEMALLOC_P(mallctlnametomib)(const char *name, size_t *mibp, | |
51 | size_t *miblenp); | |
52 | int JEMALLOC_P(mallctlbymib)(const size_t *mib, size_t miblen, void *oldp, | |
53 | size_t *oldlenp, void *newp, size_t newlen); | |
54 | ||
55 | int JEMALLOC_P(allocm)(void **ptr, size_t *rsize, size_t size, int flags) | |
56 | JEMALLOC_ATTR(nonnull(1)); | |
57 | int JEMALLOC_P(rallocm)(void **ptr, size_t *rsize, size_t size, | |
58 | size_t extra, int flags) JEMALLOC_ATTR(nonnull(1)); | |
59 | int JEMALLOC_P(sallocm)(const void *ptr, size_t *rsize, int flags) | |
60 | JEMALLOC_ATTR(nonnull(1)); | |
61 | int JEMALLOC_P(dallocm)(void *ptr, int flags) JEMALLOC_ATTR(nonnull(1)); | |
62 | ||
63 | #ifdef __cplusplus | |
64 | }; | |
65 | #endif | |
66 | #endif /* JEMALLOC_H_ */ |