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 723 #define DEFAULT_MMAP_THRESHOLD ((size_t)~0ULL) 725 #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T 728 #ifndef MAX_RELEASE_CHECK_RATE 730 #define MAX_RELEASE_CHECK_RATE 4095 732 #define MAX_RELEASE_CHECK_RATE MAX_SIZE_T 735 #ifndef USE_BUILTIN_FFS 736 #define USE_BUILTIN_FFS 0 738 #ifndef USE_DEV_RANDOM 739 #define USE_DEV_RANDOM 0 742 #define NO_MALLINFO 0 744 #ifndef MALLINFO_FIELD_TYPE 745 #define MALLINFO_FIELD_TYPE size_t 747 #ifndef NO_MALLOC_STATS 748 #define NO_MALLOC_STATS 0 750 #ifndef NO_SEGMENT_TRAVERSAL 751 #define NO_SEGMENT_TRAVERSAL 0 761 #define M_TRIM_THRESHOLD (-1) 762 #define M_GRANULARITY (-2) 763 #define M_MMAP_THRESHOLD (-3) 792 #if 0 // def HAVE_USR_INCLUDE_MALLOC_H 793 #include "/usr/include/malloc.h" 795 #ifndef STRUCT_MALLINFO_DECLARED 797 #define _STRUCT_MALLINFO 798 #define STRUCT_MALLINFO_DECLARED 1 821 #if defined(__GNUC__) 822 #define FORCEINLINE __inline __attribute__ ((always_inline)) 823 #elif defined(_MSC_VER) 824 #define FORCEINLINE __forceinline 828 #if defined(__GNUC__) 829 #define NOINLINE __attribute__ ((noinline)) 830 #elif defined(_MSC_VER) 831 #define NOINLINE __declspec(noinline) 840 #define FORCEINLINE inline 851 #ifndef USE_DL_PREFIX 852 #define dlcalloc calloc 854 #define dlmalloc malloc 855 #define dlmemalign memalign 856 #define dlposix_memalign posix_memalign 857 #define dlrealloc realloc 858 #define dlrealloc_in_place realloc_in_place 859 #define dlvalloc valloc 860 #define dlpvalloc pvalloc 862 #define dlmallopt mallopt 863 #define dlmalloc_trim malloc_trim 864 #define dlmalloc_stats malloc_stats 865 #define dlmalloc_usable_size malloc_usable_size 866 #define dlmalloc_footprint malloc_footprint 867 #define dlmalloc_max_footprint malloc_max_footprint 868 #define dlmalloc_footprint_limit malloc_footprint_limit 869 #define dlmalloc_set_footprint_limit malloc_set_footprint_limit 870 #define dlmalloc_inspect_all malloc_inspect_all 871 #define dlindependent_calloc independent_calloc 872 #define dlindependent_comalloc independent_comalloc 873 #define dlbulk_free bulk_free 1051 #if MALLOC_INSPECT_ALL 1080 DLMALLOC_EXPORT void dlmalloc_inspect_all(
void(*handler)(
void*,
void *,
size_t,
void*),
1398 size_t elem_size,
void* chunks[]);
1405 size_t sizes[],
void* chunks[]);
1451 unsigned long n_user_data_bytes,
1452 unsigned long align,
size_t dlmalloc_footprint(void)
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)
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)
DLMALLOC_EXPORT void mheap_put_trace(uword offset, uword size)
MALLINFO_FIELD_TYPE usmblks
DLMALLOC_EXPORT void mspace_disable_expand(mspace msp)
void * dlrealloc(void *oldmem, size_t bytes)
DLMALLOC_EXPORT int mspace_is_traced(mspace msp)
DLMALLOC_EXPORT mspace create_mspace(size_t capacity, int locked)
DLMALLOC_EXPORT void mspace_get_address_and_size(mspace msp, char **addrp, size_t *sizep)
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)
DLMALLOC_EXPORT void * mspace_get_aligned(mspace msp, unsigned long n_user_data_bytes, unsigned long align, unsigned long align_offset)
#define MALLINFO_FIELD_TYPE
DLMALLOC_EXPORT size_t destroy_mspace(mspace msp)
DLMALLOC_EXPORT size_t mspace_footprint(mspace msp)
DLMALLOC_EXPORT void mheap_get_trace(uword offset, uword 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)