jemalloc.h revision 9ebe2acb722ad8e29179cfbff35547f607e0f532
15daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifndef JEMALLOC_H_
25daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_H_
35daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifdef __cplusplus
45daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferrisextern "C" {
55daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
65daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
75daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/* Defined if __attribute__((...)) syntax is supported. */
85daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_HAVE_ATTR
95daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
105daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/*
115daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * Define overrides for non-standard allocator-related functions if they are
125daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * present on the system.
135daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris */
145daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_OVERRIDE_MEMALIGN
155daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_OVERRIDE_VALLOC
165daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
175daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/*
185daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * At least Linux omits the "const" in:
195daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris *
205daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris *   size_t malloc_usable_size(const void *ptr);
215daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris *
225daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * Match the operating system's prototype.
235daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris */
245daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_USABLE_SIZE_CONST const
255daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
265daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/* sizeof(void *) == 2^LG_SIZEOF_PTR. */
279ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferris#ifdef __LP64__
289ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferris#define	LG_SIZEOF_PTR 3
299ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferris#else
305daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	LG_SIZEOF_PTR 2
319ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferris#endif
325daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
335daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/*
345daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * Name mangling for public symbols is controlled by --with-mangling and
355daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * --with-jemalloc-prefix.  With default settings the je_ prefix is stripped by
365daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * these macro definitions.
375daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris */
385daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifndef JEMALLOC_NO_RENAME
395daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_malloc_conf je_malloc_conf
405daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_malloc_message je_malloc_message
415daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_malloc je_malloc
425daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_calloc je_calloc
435daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_posix_memalign je_posix_memalign
445daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_aligned_alloc je_aligned_alloc
455daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_realloc je_realloc
465daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_free je_free
475daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_mallocx je_mallocx
485daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_rallocx je_rallocx
495daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_xallocx je_xallocx
505daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_sallocx je_sallocx
515daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_dallocx je_dallocx
525daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_nallocx je_nallocx
535daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_mallctl je_mallctl
545daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_mallctlnametomib je_mallctlnametomib
555daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_mallctlbymib je_mallctlbymib
565daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_malloc_stats_print je_malloc_stats_print
575daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_malloc_usable_size je_malloc_usable_size
585daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_memalign je_memalign
595daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define je_valloc je_valloc
605daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
615daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
625daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#include <limits.h>
635daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#include <strings.h>
645daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
655daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_VERSION ""
665daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_VERSION_MAJOR
675daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_VERSION_MINOR
685daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_VERSION_BUGFIX
695daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_VERSION_NREV
705daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#define	JEMALLOC_VERSION_GID ""
715daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
725daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define MALLOCX_LG_ALIGN(la)	(la)
735daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  if LG_SIZEOF_PTR == 2
745daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#    define MALLOCX_ALIGN(a)	(ffs(a)-1)
755daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  else
765daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#    define MALLOCX_ALIGN(a)						\
775daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris	 ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31)
785daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  endif
795daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define MALLOCX_ZERO	((int)0x40)
805daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/* Bias arena index bits so that 0 encodes "MALLOCX_ARENA() unspecified". */
815daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define MALLOCX_ARENA(a)	((int)(((a)+1) << 8))
825daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
835daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifdef JEMALLOC_HAVE_ATTR
845daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_ATTR(s) __attribute__((s))
855daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
865daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
875daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
885daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
895daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#elif _MSC_VER
905daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_ATTR(s)
915daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  ifdef DLLEXPORT
925daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#    define JEMALLOC_EXPORT __declspec(dllexport)
935daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  else
945daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#    define JEMALLOC_EXPORT __declspec(dllimport)
955daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  endif
965daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_ALIGNED(s) __declspec(align(s))
975daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_SECTION(s) __declspec(allocate(s))
985daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_NOINLINE __declspec(noinline)
995daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#else
1005daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_ATTR(s)
1015daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_EXPORT
1025daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_ALIGNED(s)
1035daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_SECTION(s)
1045daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define JEMALLOC_NOINLINE
1055daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
1065daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
1075daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/*
1085daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * The je_ prefix on the following public symbol declarations is an artifact
1095daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * of namespace management, and should be omitted in application code unless
1105daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle.h).
1115daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris */
1125daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferrisextern JEMALLOC_EXPORT const char	*je_malloc_conf;
1135daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferrisextern JEMALLOC_EXPORT void		(*je_malloc_message)(void *cbopaque,
1145daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    const char *s);
1155daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
1165daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_malloc(size_t size) JEMALLOC_ATTR(malloc);
1175daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_calloc(size_t num, size_t size)
1185daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    JEMALLOC_ATTR(malloc);
1195daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT int	je_posix_memalign(void **memptr, size_t alignment,
1205daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    size_t size) JEMALLOC_ATTR(nonnull(1));
1215daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_aligned_alloc(size_t alignment, size_t size)
1225daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    JEMALLOC_ATTR(malloc);
1235daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_realloc(void *ptr, size_t size);
1245daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	je_free(void *ptr);
1255daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
1265daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_mallocx(size_t size, int flags);
1275daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_rallocx(void *ptr, size_t size, int flags);
1285daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT size_t	je_xallocx(void *ptr, size_t size, size_t extra,
1295daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    int flags);
1305daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT size_t	je_sallocx(const void *ptr, int flags);
1315daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	je_dallocx(void *ptr, int flags);
1325daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT size_t	je_nallocx(size_t size, int flags);
1335daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
1345daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT int	je_mallctl(const char *name, void *oldp,
1355daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    size_t *oldlenp, void *newp, size_t newlen);
1365daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT int	je_mallctlnametomib(const char *name, size_t *mibp,
1375daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    size_t *miblenp);
1385daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT int	je_mallctlbymib(const size_t *mib, size_t miblen,
1395daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    void *oldp, size_t *oldlenp, void *newp, size_t newlen);
1405daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	je_malloc_stats_print(void (*write_cb)(void *,
1415daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    const char *), void *je_cbopaque, const char *opts);
1425daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT size_t	je_malloc_usable_size(
1435daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    JEMALLOC_USABLE_SIZE_CONST void *ptr);
1445daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
1455daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifdef JEMALLOC_OVERRIDE_MEMALIGN
1465daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void *	je_memalign(size_t alignment, size_t size)
1475daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    JEMALLOC_ATTR(malloc);
1485daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
1495daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
1505daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifdef JEMALLOC_OVERRIDE_VALLOC
1515daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void *	je_valloc(size_t size) JEMALLOC_ATTR(malloc);
1525daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
1535daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
1549ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferristypedef void *(chunk_alloc_t)(size_t, size_t, bool *, unsigned);
1559ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferristypedef bool (chunk_dalloc_t)(void *, size_t, unsigned);
1569ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferris
1575daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/*
1585daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * By default application code must explicitly refer to mangled symbol names,
1595daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * so that it is possible to use jemalloc in conjunction with another allocator
1605daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * in the same application.  Define JEMALLOC_MANGLE in order to cause automatic
1615daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * name mangling that matches the API prefixing that happened as a result of
1625daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * --with-mangling and/or --with-jemalloc-prefix configuration settings.
1635daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris */
1645daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifdef JEMALLOC_MANGLE
1655daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  ifndef JEMALLOC_NO_DEMANGLE
1665daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#    define JEMALLOC_NO_DEMANGLE
1675daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  endif
1685daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define malloc_conf je_malloc_conf
1695daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define malloc_message je_malloc_message
1705daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define malloc je_malloc
1715daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define calloc je_calloc
1725daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define posix_memalign je_posix_memalign
1735daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define aligned_alloc je_aligned_alloc
1745daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define realloc je_realloc
1755daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define free je_free
1765daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define mallocx je_mallocx
1775daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define rallocx je_rallocx
1785daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define xallocx je_xallocx
1795daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define sallocx je_sallocx
1805daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define dallocx je_dallocx
1815daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define nallocx je_nallocx
1825daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define mallctl je_mallctl
1835daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define mallctlnametomib je_mallctlnametomib
1845daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define mallctlbymib je_mallctlbymib
1855daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define malloc_stats_print je_malloc_stats_print
1865daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define malloc_usable_size je_malloc_usable_size
1875daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define memalign je_memalign
1885daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  define valloc je_valloc
1895daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
1905daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
1915daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/*
1925daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * The je_* macros can be used as stable alternative names for the
1935daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * public jemalloc API if JEMALLOC_NO_DEMANGLE is defined.  This is primarily
1945daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * meant for use in jemalloc itself, but it can be used by application code to
1955daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * provide isolation from the name mangling specified via --with-mangling
1965daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * and/or --with-jemalloc-prefix.
1975daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris */
1985daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifndef JEMALLOC_NO_DEMANGLE
1995daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_malloc_conf
2005daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_malloc_message
2015daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_malloc
2025daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_calloc
2035daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_posix_memalign
2045daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_aligned_alloc
2055daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_realloc
2065daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_free
2075daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_mallocx
2085daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_rallocx
2095daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_xallocx
2105daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_sallocx
2115daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_dallocx
2125daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_nallocx
2135daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_mallctl
2145daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_mallctlnametomib
2155daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_mallctlbymib
2165daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_malloc_stats_print
2175daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_malloc_usable_size
2185daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_memalign
2195daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#  undef je_valloc
2205daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
2215daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
2225daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifdef __cplusplus
2235daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris};
2245daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
2255daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif /* JEMALLOC_H_ */
226