15daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris/*
25daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * The je_ prefix on the following public symbol declarations is an artifact
35daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * of namespace management, and should be omitted in application code unless
45daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle.h).
55daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris */
65daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferrisextern JEMALLOC_EXPORT const char	*je_malloc_conf;
75daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferrisextern JEMALLOC_EXPORT void		(*je_malloc_message)(void *cbopaque,
85daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    const char *s);
95daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
105daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_malloc(size_t size) JEMALLOC_ATTR(malloc);
115daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_calloc(size_t num, size_t size)
125daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    JEMALLOC_ATTR(malloc);
135daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT int	je_posix_memalign(void **memptr, size_t alignment,
145daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    size_t size) JEMALLOC_ATTR(nonnull(1));
155daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_aligned_alloc(size_t alignment, size_t size)
165daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    JEMALLOC_ATTR(malloc);
175daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_realloc(void *ptr, size_t size);
185daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	je_free(void *ptr);
195daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
2096d58c8575eeac2a4a026e4d3629388573335bfaChristopher FerrisJEMALLOC_EXPORT void	*je_mallocx(size_t size, int flags)
2196d58c8575eeac2a4a026e4d3629388573335bfaChristopher Ferris    JEMALLOC_ATTR(malloc);
225daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	*je_rallocx(void *ptr, size_t size, int flags);
235daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT size_t	je_xallocx(void *ptr, size_t size, size_t extra,
245daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    int flags);
2596d58c8575eeac2a4a026e4d3629388573335bfaChristopher FerrisJEMALLOC_EXPORT size_t	je_sallocx(const void *ptr, int flags)
2696d58c8575eeac2a4a026e4d3629388573335bfaChristopher Ferris    JEMALLOC_ATTR(pure);
275daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	je_dallocx(void *ptr, int flags);
2896d58c8575eeac2a4a026e4d3629388573335bfaChristopher FerrisJEMALLOC_EXPORT void	je_sdallocx(void *ptr, size_t size, int flags);
2996d58c8575eeac2a4a026e4d3629388573335bfaChristopher FerrisJEMALLOC_EXPORT size_t	je_nallocx(size_t size, int flags)
3096d58c8575eeac2a4a026e4d3629388573335bfaChristopher Ferris    JEMALLOC_ATTR(pure);
315daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
325daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT int	je_mallctl(const char *name, void *oldp,
335daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    size_t *oldlenp, void *newp, size_t newlen);
345daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT int	je_mallctlnametomib(const char *name, size_t *mibp,
355daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    size_t *miblenp);
365daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT int	je_mallctlbymib(const size_t *mib, size_t miblen,
375daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    void *oldp, size_t *oldlenp, void *newp, size_t newlen);
385daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void	je_malloc_stats_print(void (*write_cb)(void *,
395daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    const char *), void *je_cbopaque, const char *opts);
405daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT size_t	je_malloc_usable_size(
415daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    JEMALLOC_USABLE_SIZE_CONST void *ptr);
425daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
435daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifdef JEMALLOC_OVERRIDE_MEMALIGN
445daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void *	je_memalign(size_t alignment, size_t size)
455daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris    JEMALLOC_ATTR(malloc);
465daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
475daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris
485daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#ifdef JEMALLOC_OVERRIDE_VALLOC
495daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher FerrisJEMALLOC_EXPORT void *	je_valloc(size_t size) JEMALLOC_ATTR(malloc);
505daf4e4a8d52ac2d5b40b0d12ce5721c6b9676e7Christopher Ferris#endif
519ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferris
529ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferristypedef void *(chunk_alloc_t)(size_t, size_t, bool *, unsigned);
539ebe2acb722ad8e29179cfbff35547f607e0f532Christopher Ferristypedef bool (chunk_dalloc_t)(void *, size_t, unsigned);
54