michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * Helper header to declare all the supported malloc functions. michael@0: * MALLOC_DECL arguments are: michael@0: * - function name michael@0: * - return type michael@0: * - argument types michael@0: */ michael@0: michael@0: #ifndef malloc_decls_h michael@0: # define malloc_decls_h michael@0: michael@0: # include "jemalloc_types.h" michael@0: michael@0: # if defined(__linux__) && (!defined(MOZ_MEMORY_ANDROID) || ANDROID_VERSION < 19) michael@0: typedef void * usable_ptr_t; michael@0: # else michael@0: typedef const void * usable_ptr_t; michael@0: # endif michael@0: michael@0: # define MALLOC_FUNCS_MALLOC 1 michael@0: # define MALLOC_FUNCS_JEMALLOC 2 michael@0: # define MALLOC_FUNCS_INIT 4 michael@0: # define MALLOC_FUNCS_ALL (MALLOC_FUNCS_INIT | MALLOC_FUNCS_MALLOC | MALLOC_FUNCS_JEMALLOC) michael@0: michael@0: #endif /* malloc_decls_h */ michael@0: michael@0: #ifndef MALLOC_FUNCS michael@0: # define MALLOC_FUNCS (MALLOC_FUNCS_MALLOC | MALLOC_FUNCS_JEMALLOC) michael@0: #endif michael@0: michael@0: #ifdef MALLOC_DECL michael@0: # if MALLOC_FUNCS & MALLOC_FUNCS_INIT michael@0: MALLOC_DECL(init, void, const malloc_table_t *) michael@0: # endif michael@0: # if MALLOC_FUNCS & MALLOC_FUNCS_MALLOC michael@0: MALLOC_DECL(malloc, void *, size_t) michael@0: MALLOC_DECL(posix_memalign, int, void **, size_t, size_t) michael@0: MALLOC_DECL(aligned_alloc, void *, size_t, size_t) michael@0: MALLOC_DECL(calloc, void *, size_t, size_t) michael@0: MALLOC_DECL(realloc, void *, void *, size_t) michael@0: MALLOC_DECL(free, void, void *) michael@0: MALLOC_DECL(memalign, void *, size_t, size_t) michael@0: MALLOC_DECL(valloc, void *, size_t) michael@0: MALLOC_DECL(malloc_usable_size, size_t, usable_ptr_t) michael@0: MALLOC_DECL(malloc_good_size, size_t, size_t) michael@0: # endif michael@0: # if MALLOC_FUNCS & MALLOC_FUNCS_JEMALLOC michael@0: MALLOC_DECL(jemalloc_stats, void, jemalloc_stats_t *) michael@0: MALLOC_DECL(jemalloc_purge_freed_pages, void, void) michael@0: MALLOC_DECL(jemalloc_free_dirty_pages, void, void) michael@0: # endif michael@0: #endif /* MALLOC_DECL */ michael@0: michael@0: #undef MALLOC_DECL michael@0: #undef MALLOC_FUNCS