531 #define DLM_MAGIC_CONSTANT 0xdeaddabe 534 #define DLM_ABORT {extern void os_panic(void); os_panic(); abort();} 535 #define ONLY_MSPACES 1 540 #ifndef DLMALLOC_VERSION 541 #define DLMALLOC_VERSION 20806 544 #ifndef DLMALLOC_EXPORT 545 #define DLMALLOC_EXPORT extern 553 #define LACKS_FCNTL_H 558 #define WIN32_LEAN_AND_MEAN 562 #define HAVE_MORECORE 0 563 #define LACKS_UNISTD_H 564 #define LACKS_SYS_PARAM_H 565 #define LACKS_SYS_MMAN_H 566 #define LACKS_STRING_H 567 #define LACKS_STRINGS_H 568 #define LACKS_SYS_TYPES_H 569 #define LACKS_ERRNO_H 570 #define LACKS_SCHED_H 571 #ifndef MALLOC_FAILURE_ACTION 572 #define MALLOC_FAILURE_ACTION 576 #define MMAP_CLEARS 0 578 #define MMAP_CLEARS 1 583 #if defined(DARWIN) || defined(_DARWIN) 585 #ifndef HAVE_MORECORE 586 #define HAVE_MORECORE 0 589 #ifndef MALLOC_ALIGNMENT 590 #define MALLOC_ALIGNMENT ((size_t)16U) 595 #ifndef LACKS_SYS_TYPES_H 596 #include <sys/types.h> 600 #define MAX_SIZE_T (~(size_t)0) 603 #define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \ 604 (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0)) 608 #if ((defined(__GNUC__) && \ 609 ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) || \ 610 defined(__i386__) || defined(__x86_64__))) || \ 611 (defined(_MSC_VER) && _MSC_VER>=1310)) 612 #ifndef USE_SPIN_LOCKS 613 #define USE_SPIN_LOCKS 1 616 #error "USE_SPIN_LOCKS defined without implementation" 618 #elif !defined(USE_SPIN_LOCKS) 619 #define USE_SPIN_LOCKS 0 623 #define ONLY_MSPACES 1 632 #ifndef MALLOC_ALIGNMENT 633 #define MALLOC_ALIGNMENT ((size_t)(2 * sizeof(void *))) 639 #define DLM_ABORT abort() 641 #ifndef DLM_ABORT_ON_ASSERT_FAILURE 642 #define DLM_ABORT_ON_ASSERT_FAILURE 1 644 #ifndef PROCEED_ON_ERROR 645 #define PROCEED_ON_ERROR 0 651 #ifndef MALLOC_INSPECT_ALL 652 #define MALLOC_INSPECT_ALL 0 658 #define MMAP_CLEARS 1 662 #define HAVE_MREMAP 1 665 #define HAVE_MREMAP 0 668 #ifndef MALLOC_FAILURE_ACTION 669 #define MALLOC_FAILURE_ACTION errno = ENOMEM; 671 #ifndef HAVE_MORECORE 673 #define HAVE_MORECORE 0 675 #define HAVE_MORECORE 1 679 #define MORECORE_CONTIGUOUS 0 681 #define MORECORE_DEFAULT sbrk 682 #ifndef MORECORE_CONTIGUOUS 683 #define MORECORE_CONTIGUOUS 1 686 #ifndef DEFAULT_GRANULARITY 687 #if (MORECORE_CONTIGUOUS || defined(WIN32)) 688 #define DEFAULT_GRANULARITY (0) 690 #define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) 693 #ifndef DEFAULT_TRIM_THRESHOLD 694 #ifndef MORECORE_CANNOT_TRIM 695 #define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) 697 #define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T 700 #ifndef DEFAULT_MMAP_THRESHOLD 702 #define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U) 704 #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T 707 #ifndef MAX_RELEASE_CHECK_RATE 709 #define MAX_RELEASE_CHECK_RATE 4095 711 #define MAX_RELEASE_CHECK_RATE MAX_SIZE_T 714 #ifndef USE_BUILTIN_FFS 715 #define USE_BUILTIN_FFS 0 717 #ifndef USE_DEV_RANDOM 718 #define USE_DEV_RANDOM 0 721 #define NO_MALLINFO 0 723 #ifndef MALLINFO_FIELD_TYPE 724 #define MALLINFO_FIELD_TYPE size_t 726 #ifndef NO_MALLOC_STATS 727 #define NO_MALLOC_STATS 0 729 #ifndef NO_SEGMENT_TRAVERSAL 730 #define NO_SEGMENT_TRAVERSAL 0 740 #define M_TRIM_THRESHOLD (-1) 741 #define M_GRANULARITY (-2) 742 #define M_MMAP_THRESHOLD (-3) 771 #if 0 // def HAVE_USR_INCLUDE_MALLOC_H 772 #include "/usr/include/malloc.h" 774 #ifndef STRUCT_MALLINFO_DECLARED 776 #define _STRUCT_MALLINFO 777 #define STRUCT_MALLINFO_DECLARED 1 800 #if defined(__GNUC__) 801 #define FORCEINLINE __inline __attribute__ ((always_inline)) 802 #elif defined(_MSC_VER) 803 #define FORCEINLINE __forceinline 807 #if defined(__GNUC__) 808 #define NOINLINE __attribute__ ((noinline)) 809 #elif defined(_MSC_VER) 810 #define NOINLINE __declspec(noinline) 819 #define FORCEINLINE inline 830 #ifndef USE_DL_PREFIX 831 #define dlcalloc calloc 833 #define dlmalloc malloc 834 #define dlmemalign memalign 835 #define dlposix_memalign posix_memalign 836 #define dlrealloc realloc 837 #define dlrealloc_in_place realloc_in_place 838 #define dlvalloc valloc 839 #define dlpvalloc pvalloc 841 #define dlmallopt mallopt 842 #define dlmalloc_trim malloc_trim 843 #define dlmalloc_stats malloc_stats 844 #define dlmalloc_usable_size malloc_usable_size 845 #define dlmalloc_footprint malloc_footprint 846 #define dlmalloc_max_footprint malloc_max_footprint 847 #define dlmalloc_footprint_limit malloc_footprint_limit 848 #define dlmalloc_set_footprint_limit malloc_set_footprint_limit 849 #define dlmalloc_inspect_all malloc_inspect_all 850 #define dlindependent_calloc independent_calloc 851 #define dlindependent_comalloc independent_comalloc 852 #define dlbulk_free bulk_free 1030 #if MALLOC_INSPECT_ALL 1059 DLMALLOC_EXPORT void dlmalloc_inspect_all(
void(*handler)(
void*,
void *,
size_t,
void*),
1377 size_t elem_size,
void* chunks[]);
1384 size_t sizes[],
void* chunks[]);
1430 unsigned long long n_user_data_bytes,
1431 unsigned long long align,
1437 unsigned long long *addrp,
1438 unsigned long long *sizep);
size_t dlmalloc_footprint(void)
DLMALLOC_EXPORT void mspace_get_address_and_size(mspace msp, unsigned long long *addrp, unsigned long long *sizep)
void ** dlindependent_calloc(size_t n_elements, size_t elem_size, void *chunks[])
DLMALLOC_EXPORT int mspace_trim(mspace msp, size_t pad)
u8 pad[3]
log2 (size of the packing page block)
DLMALLOC_EXPORT void * mspace_malloc(mspace msp, size_t bytes)
void * dlmemalign(size_t alignment, size_t bytes)
DLMALLOC_EXPORT void ** mspace_independent_calloc(mspace msp, size_t n_elements, size_t elem_size, void *chunks[])
size_t dlbulk_free(void *array[], size_t nelem)
DLMALLOC_EXPORT void * mspace_realloc(mspace msp, void *mem, size_t newsize)
void * dlpvalloc(size_t bytes)
DLMALLOC_EXPORT struct dlmallinfo mspace_mallinfo(mspace msp)
MALLINFO_FIELD_TYPE hblkhd
DLMALLOC_EXPORT mspace create_mspace_with_base(void *base, size_t capacity, int locked)
DLMALLOC_EXPORT int mspace_is_heap_object(mspace msp, void *p)
DLMALLOC_EXPORT void * mspace_get_aligned(mspace msp, unsigned long long n_user_data_bytes, unsigned long long align, unsigned long long align_offset)
MALLINFO_FIELD_TYPE uordblks
DLMALLOC_EXPORT void * mspace_calloc(mspace msp, size_t n_elements, size_t elem_size)
MALLINFO_FIELD_TYPE arena
size_t dlmalloc_usable_size(void *mem)
DLMALLOC_EXPORT void mspace_put_no_offset(mspace msp, void *p)
MALLINFO_FIELD_TYPE fsmblks
MALLINFO_FIELD_TYPE ordblks
void * dlmalloc(size_t bytes)
void * dlvalloc(size_t bytes)
MALLINFO_FIELD_TYPE hblks
int dlmalloc_trim(size_t pad)
DLMALLOC_EXPORT void * mspace_memalign(mspace msp, size_t alignment, size_t bytes)
DLMALLOC_EXPORT void mspace_malloc_stats(mspace msp)
MALLINFO_FIELD_TYPE usmblks
DLMALLOC_EXPORT void mspace_disable_expand(mspace msp)
void * dlrealloc(void *oldmem, size_t bytes)
DLMALLOC_EXPORT mspace create_mspace(size_t capacity, int locked)
DLMALLOC_EXPORT int mspace_mallopt(int, int)
DLMALLOC_EXPORT void ** mspace_independent_comalloc(mspace msp, size_t n_elements, size_t sizes[], void *chunks[])
size_t dlmalloc_max_footprint(void)
MALLINFO_FIELD_TYPE keepcost
DLMALLOC_EXPORT int mspace_enable_disable_trace(mspace msp, int enable)
MALLINFO_FIELD_TYPE smblks
DLMALLOC_EXPORT void mspace_free(mspace msp, void *mem)
template key/value backing page structure
DLMALLOC_EXPORT size_t mspace_usable_size(const void *mem)
void * dlrealloc_in_place(void *oldmem, size_t bytes)
#define MALLINFO_FIELD_TYPE
DLMALLOC_EXPORT void mheap_get_trace(u64 offset, u64 size)
DLMALLOC_EXPORT size_t destroy_mspace(mspace msp)
DLMALLOC_EXPORT size_t mspace_footprint(mspace msp)
DLMALLOC_EXPORT void mheap_put_trace(u64 offset, u64 size)
DLMALLOC_EXPORT void mspace_put(mspace msp, void *p)
MALLINFO_FIELD_TYPE fordblks
DLMALLOC_EXPORT size_t mspace_usable_size_with_delta(const void *p)
void ** dlindependent_comalloc(size_t n_elements, size_t sizes[], void *chunks[])
int dlmallopt(int param_number, int value)
size_t dlmalloc_set_footprint_limit(size_t bytes)
DLMALLOC_EXPORT int mspace_track_large_chunks(mspace msp, int enable)
int dlposix_memalign(void **pp, size_t alignment, size_t bytes)
DLMALLOC_EXPORT void * mspace_least_addr(mspace msp)
size_t dlmalloc_footprint_limit(void)
DLMALLOC_EXPORT size_t mspace_max_footprint(mspace msp)
void * dlcalloc(size_t n_elements, size_t elem_size)