|
Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include <sys/types.h>#include <stdio.h>#include <errno.h>#include <stdlib.h>#include <string.h>#include <sys/param.h>Go to the source code of this file.
Data Structures | |
| struct | mallinfo |
| struct | malloc_chunk |
| struct | malloc_tree_chunk |
| struct | malloc_segment |
| struct | malloc_state |
| struct | malloc_params |
Macros | |
| #define | MAX_SIZE_T (~(size_t)0) |
| #define | ONLY_MSPACES 0 |
| #define | MSPACES 0 |
| #define | MALLOC_ALIGNMENT ((size_t)8U) |
| #define | FOOTERS 0 |
| #define | ABORT abort() |
| #define | ABORT_ON_ASSERT_FAILURE 1 |
| #define | PROCEED_ON_ERROR 0 |
| #define | USE_LOCKS 0 |
| #define | INSECURE 0 |
| #define | HAVE_MMAP 1 |
| #define | MMAP_CLEARS 1 |
| #define | HAVE_MREMAP 0 |
| #define | MALLOC_FAILURE_ACTION errno = ENOMEM; |
| #define | HAVE_MORECORE 1 |
| #define | MORECORE_CONTIGUOUS 0 |
| #define | DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) |
| #define | DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) |
| #define | DEFAULT_MMAP_THRESHOLD MAX_SIZE_T |
| #define | USE_BUILTIN_FFS 0 |
| #define | USE_DEV_RANDOM 0 |
| #define | NO_MALLINFO 0 |
| #define | MALLINFO_FIELD_TYPE size_t |
| #define | M_TRIM_THRESHOLD (-1) |
| #define | M_GRANULARITY (-2) |
| #define | M_MMAP_THRESHOLD (-3) |
| #define | _STRUCT_MALLINFO |
| #define | dlcalloc calloc |
| #define | dlfree free |
| #define | dlmalloc malloc |
| #define | dlmemalign memalign |
| #define | dlrealloc realloc |
| #define | dlvalloc valloc |
| #define | dlpvalloc pvalloc |
| #define | dlmallinfo mallinfo |
| #define | dlmallopt mallopt |
| #define | dlmalloc_trim malloc_trim |
| #define | dlmalloc_stats malloc_stats |
| #define | dlmalloc_usable_size malloc_usable_size |
| #define | dlmalloc_footprint malloc_footprint |
| #define | dlmalloc_max_footprint malloc_max_footprint |
| #define | dlindependent_calloc independent_calloc |
| #define | dlindependent_comalloc independent_comalloc |
| #define | assert(x) |
| #define | malloc_getpagesize ((size_t)4096U) |
| #define | SIZE_T_SIZE (sizeof(size_t)) |
| #define | SIZE_T_BITSIZE (sizeof(size_t) << 3) |
| #define | SIZE_T_ZERO ((size_t)0) |
| #define | SIZE_T_ONE ((size_t)1) |
| #define | SIZE_T_TWO ((size_t)2) |
| #define | TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) |
| #define | FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) |
| #define | SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) |
| #define | HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) |
| #define | CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) |
| #define | is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) |
| #define | align_offset(A) |
| #define | MFAIL ((void*)(MAX_SIZE_T)) |
| #define | CMFAIL ((char*)(MFAIL)) /* defined for convenience */ |
| #define | IS_MMAPPED_BIT (SIZE_T_ZERO) |
| #define | USE_MMAP_BIT (SIZE_T_ZERO) |
| #define | CALL_MMAP(s) MFAIL |
| #define | CALL_MUNMAP(a, s) (-1) |
| #define | DIRECT_MMAP(s) MFAIL |
| #define | CALL_MREMAP(addr, osz, nsz, mv) MFAIL |
| #define | CALL_MORECORE(S) MFAIL |
| #define | USE_NONCONTIGUOUS_BIT (4U) |
| #define | EXTERN_BIT (8U) |
| #define | USE_LOCK_BIT (0U) |
| #define | INITIAL_LOCK(l) |
| #define | ACQUIRE_MORECORE_LOCK() |
| #define | RELEASE_MORECORE_LOCK() |
| #define | ACQUIRE_MAGIC_INIT_LOCK() |
| #define | RELEASE_MAGIC_INIT_LOCK() |
| #define | MCHUNK_SIZE (sizeof(mchunk)) |
| #define | CHUNK_OVERHEAD (SIZE_T_SIZE) |
| #define | MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) |
| #define | MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) |
| #define | MIN_CHUNK_SIZE ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
| #define | chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) |
| #define | mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) |
| #define | align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) |
| #define | MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) |
| #define | MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) |
| #define | pad_request(req) (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
| #define | request2size(req) (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) |
| #define | PINUSE_BIT (SIZE_T_ONE) |
| #define | CINUSE_BIT (SIZE_T_TWO) |
| #define | INUSE_BITS (PINUSE_BIT|CINUSE_BIT) |
| #define | FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) |
| #define | cinuse(p) ((p)->head & CINUSE_BIT) |
| #define | pinuse(p) ((p)->head & PINUSE_BIT) |
| #define | chunksize(p) ((p)->head & ~(INUSE_BITS)) |
| #define | clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) |
| #define | clear_cinuse(p) ((p)->head &= ~CINUSE_BIT) |
| #define | chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) |
| #define | chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) |
| #define | next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) |
| #define | prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) |
| #define | next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) |
| #define | get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) |
| #define | set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) |
| #define | set_size_and_pinuse_of_free_chunk(p, s) ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) |
| #define | set_free_with_pinuse(p, s, n) (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) |
| #define | is_mmapped(p) (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) |
| #define | overhead_for(p) (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) |
| #define | calloc_must_clear(p) (1) |
| #define | leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) |
| #define | get_segment_flags(S) ((S)->sflags) |
| #define | set_segment_flags(S, v) ((S)->sflags = (v)) |
| #define | check_segment_merge(S, b, s) (1) |
| #define | is_mmapped_segment(S) (get_segment_flags(S) & IS_MMAPPED_BIT) |
| #define | is_extern_segment(S) (get_segment_flags(S) & EXTERN_BIT) |
| #define | NSMALLBINS (32U) |
| #define | NTREEBINS (32U) |
| #define | SMALLBIN_SHIFT (3U) |
| #define | SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) |
| #define | TREEBIN_SHIFT (8U) |
| #define | MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) |
| #define | MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) |
| #define | MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) |
| #define | gm (&_gm_) |
| #define | is_global(M) ((M) == &_gm_) |
| #define | is_initialized(M) ((M)->top != 0) |
| #define | use_lock(M) ((M)->mflags & USE_LOCK_BIT) |
| #define | enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) |
| #define | disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) |
| #define | use_mmap(M) ((M)->mflags & USE_MMAP_BIT) |
| #define | enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) |
| #define | disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) |
| #define | use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) |
| #define | disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) |
| #define | set_lock(M, L) |
| #define | page_align(S) (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) |
| #define | granularity_align(S) (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) |
| #define | is_page_aligned(S) (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) |
| #define | is_granularity_aligned(S) (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) |
| #define | segment_holds(S, A) ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) |
| #define | should_trim(M, s) ((s) > (M)->trim_check) |
| #define | TOP_FOOT_SIZE (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) |
| #define | PREACTION(M) (0) |
| #define | POSTACTION(M) |
| #define | CORRUPTION_ERROR_ACTION(m) ABORT |
| #define | USAGE_ERROR_ACTION(m, p) ABORT |
| #define | check_free_chunk(M, P) |
| #define | check_inuse_chunk(M, P) |
| #define | check_malloced_chunk(M, P, N) |
| #define | check_mmapped_chunk(M, P) |
| #define | check_malloc_state(M) |
| #define | check_top_chunk(M, P) |
| #define | is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) |
| #define | small_index(s) ((s) >> SMALLBIN_SHIFT) |
| #define | small_index2size(i) ((i) << SMALLBIN_SHIFT) |
| #define | MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) |
| #define | smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) |
| #define | treebin_at(M, i) (&((M)->treebins[i])) |
| #define | compute_tree_index(S, I) |
| #define | bit_for_tree_index(i) (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) |
| #define | leftshift_for_tree_index(i) |
| #define | minsize_for_tree_index(i) |
| #define | idx2bit(i) ((binmap_t)(1) << (i)) |
| #define | mark_smallmap(M, i) ((M)->smallmap |= idx2bit(i)) |
| #define | clear_smallmap(M, i) ((M)->smallmap &= ~idx2bit(i)) |
| #define | smallmap_is_marked(M, i) ((M)->smallmap & idx2bit(i)) |
| #define | mark_treemap(M, i) ((M)->treemap |= idx2bit(i)) |
| #define | clear_treemap(M, i) ((M)->treemap &= ~idx2bit(i)) |
| #define | treemap_is_marked(M, i) ((M)->treemap & idx2bit(i)) |
| #define | compute_bit2idx(X, I) |
| #define | least_bit(x) ((x) & -(x)) |
| #define | left_bits(x) ((x<<1) | -(x<<1)) |
| #define | same_or_left_bits(x) ((x) | -(x)) |
| #define | ok_address(M, a) ((char*)(a) >= (M)->least_addr) |
| #define | ok_next(p, n) ((char*)(p) < (char*)(n)) |
| #define | ok_cinuse(p) cinuse(p) |
| #define | ok_pinuse(p) pinuse(p) |
| #define | ok_magic(M) (1) |
| #define | RTCHECK(e) __builtin_expect(e, 1) |
| #define | mark_inuse_foot(M, p, s) |
| #define | set_inuse(M, p, s) |
| #define | set_inuse_and_pinuse(M, p, s) |
| #define | set_size_and_pinuse_of_inuse_chunk(M, p, s) ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) |
| #define | insert_small_chunk(M, P, S) |
| #define | unlink_small_chunk(M, P, S) |
| #define | unlink_first_small_chunk(M, B, P, I) |
| #define | replace_dv(M, P, S) |
| #define | insert_large_chunk(M, X, S) |
| #define | unlink_large_chunk(M, X) |
| #define | insert_chunk(M, P, S) |
| #define | unlink_chunk(M, P, S) |
| #define | internal_malloc(m, b) dlmalloc(b) |
| #define | internal_free(m, mem) dlfree(mem) |
| #define | fm gm |
Typedefs | |
| typedef struct malloc_chunk | mchunk |
| typedef struct malloc_chunk * | mchunkptr |
| typedef struct malloc_chunk * | sbinptr |
| typedef size_t | bindex_t |
| typedef unsigned int | binmap_t |
| typedef unsigned int | flag_t |
| typedef struct malloc_tree_chunk | tchunk |
| typedef struct malloc_tree_chunk * | tchunkptr |
| typedef struct malloc_tree_chunk * | tbinptr |
| typedef struct malloc_segment | msegment |
| typedef struct malloc_segment * | msegmentptr |
| typedef struct malloc_state * | mstate |
Functions | |
| void * | dlmalloc (size_t) |
| void | dlfree (void *) |
| void * | dlcalloc (size_t, size_t) |
| void * | dlrealloc (void *, size_t) |
| void * | dlmemalign (size_t, size_t) |
| void * | dlvalloc (size_t) |
| int | dlmallopt (int, int) |
| void ** | dlindependent_calloc (size_t, size_t, void **) |
| void ** | dlindependent_comalloc (size_t, size_t *, void **) |
| void * | dlpvalloc (size_t) |
| int | dlmalloc_trim (size_t) |
| size_t | dlmalloc_usable_size (void *) |
| void ** | dlindependent_calloc (size_t n_elements, size_t elem_size, void *chunks[]) |
| void ** | dlindependent_comalloc (size_t n_elements, size_t sizes[], void *chunks[]) |
| #define _STRUCT_MALLINFO |
Definition at line 626 of file dlmalloc.c.
| #define ABORT abort() |
Definition at line 502 of file dlmalloc.c.
| #define ABORT_ON_ASSERT_FAILURE 1 |
Definition at line 505 of file dlmalloc.c.
| #define ACQUIRE_MAGIC_INIT_LOCK | ( | ) |
Definition at line 1512 of file dlmalloc.c.
| #define ACQUIRE_MORECORE_LOCK | ( | ) |
Definition at line 1504 of file dlmalloc.c.
Definition at line 1691 of file dlmalloc.c.
| #define align_offset | ( | A | ) |
Definition at line 1274 of file dlmalloc.c.
| #define assert | ( | x | ) |
Definition at line 1176 of file dlmalloc.c.
| #define bit_for_tree_index | ( | i | ) | (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) |
Definition at line 2329 of file dlmalloc.c.
| #define CALL_MMAP | ( | s | ) | MFAIL |
Definition at line 1294 of file dlmalloc.c.
Definition at line 1409 of file dlmalloc.c.
| #define CALL_MREMAP | ( | addr, | |
| osz, | |||
| nsz, | |||
| mv | |||
| ) | MFAIL |
Definition at line 1403 of file dlmalloc.c.
| #define CALL_MUNMAP | ( | a, | |
| s | |||
| ) | (-1) |
Definition at line 1295 of file dlmalloc.c.
| #define calloc_must_clear | ( | p | ) | (1) |
Definition at line 1765 of file dlmalloc.c.
Definition at line 2253 of file dlmalloc.c.
Definition at line 2254 of file dlmalloc.c.
| #define check_malloc_state | ( | M | ) |
Definition at line 2257 of file dlmalloc.c.
Definition at line 2255 of file dlmalloc.c.
Definition at line 2256 of file dlmalloc.c.
| #define check_segment_merge | ( | S, | |
| b, | |||
| s | |||
| ) | (1) |
Definition at line 1972 of file dlmalloc.c.
Definition at line 2258 of file dlmalloc.c.
| #define chunk2mem | ( | p | ) | ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) |
Definition at line 1688 of file dlmalloc.c.
| #define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) |
Definition at line 1268 of file dlmalloc.c.
| #define chunk_minus_offset | ( | p, | |
| s | |||
| ) | ((mchunkptr)(((char*)(p)) - (s))) |
Definition at line 1733 of file dlmalloc.c.
| #define CHUNK_OVERHEAD (SIZE_T_SIZE) |
Definition at line 1675 of file dlmalloc.c.
| #define chunk_plus_offset | ( | p, | |
| s | |||
| ) | ((mchunkptr)(((char*)(p)) + (s))) |
Definition at line 1732 of file dlmalloc.c.
| #define chunksize | ( | p | ) | ((p)->head & ~(INUSE_BITS)) |
Definition at line 1726 of file dlmalloc.c.
| #define cinuse | ( | p | ) | ((p)->head & CINUSE_BIT) |
Definition at line 1724 of file dlmalloc.c.
| #define CINUSE_BIT (SIZE_T_TWO) |
Definition at line 1717 of file dlmalloc.c.
| #define clear_cinuse | ( | p | ) | ((p)->head &= ~CINUSE_BIT) |
Definition at line 1729 of file dlmalloc.c.
| #define clear_pinuse | ( | p | ) | ((p)->head &= ~PINUSE_BIT) |
Definition at line 1728 of file dlmalloc.c.
Definition at line 2350 of file dlmalloc.c.
Definition at line 2354 of file dlmalloc.c.
| #define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ |
Definition at line 1289 of file dlmalloc.c.
| #define compute_bit2idx | ( | X, | |
| I | |||
| ) |
| #define CORRUPTION_ERROR_ACTION | ( | m | ) | ABORT |
Definition at line 2240 of file dlmalloc.c.
Definition at line 553 of file dlmalloc.c.
| #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T |
Definition at line 567 of file dlmalloc.c.
Definition at line 558 of file dlmalloc.c.
| #define DIRECT_MMAP | ( | s | ) | MFAIL |
Definition at line 1296 of file dlmalloc.c.
| #define disable_contiguous | ( | M | ) | ((M)->mflags |= USE_NONCONTIGUOUS_BIT) |
Definition at line 2130 of file dlmalloc.c.
| #define disable_lock | ( | M | ) | ((M)->mflags &= ~USE_LOCK_BIT) |
Definition at line 2123 of file dlmalloc.c.
| #define disable_mmap | ( | M | ) | ((M)->mflags &= ~USE_MMAP_BIT) |
Definition at line 2127 of file dlmalloc.c.
| #define dlcalloc calloc |
Definition at line 653 of file dlmalloc.c.
| #define dlfree free |
Definition at line 654 of file dlmalloc.c.
| #define dlindependent_calloc independent_calloc |
Definition at line 667 of file dlmalloc.c.
| #define dlindependent_comalloc independent_comalloc |
Definition at line 668 of file dlmalloc.c.
Definition at line 660 of file dlmalloc.c.
| #define dlmalloc malloc |
Definition at line 655 of file dlmalloc.c.
| size_t dlmalloc_footprint | ( | void | ) | malloc_footprint |
Definition at line 665 of file dlmalloc.c.
| size_t dlmalloc_max_footprint | ( | void | ) | malloc_max_footprint |
Definition at line 666 of file dlmalloc.c.
| void dlmalloc_stats | ( | void | ) | malloc_stats |
Definition at line 663 of file dlmalloc.c.
| #define dlmalloc_trim malloc_trim |
Definition at line 662 of file dlmalloc.c.
| #define dlmalloc_usable_size malloc_usable_size |
Definition at line 664 of file dlmalloc.c.
| #define dlmallopt mallopt |
Definition at line 661 of file dlmalloc.c.
| #define dlmemalign memalign |
Definition at line 656 of file dlmalloc.c.
| #define dlpvalloc pvalloc |
Definition at line 659 of file dlmalloc.c.
| #define dlrealloc realloc |
Definition at line 657 of file dlmalloc.c.
| #define dlvalloc valloc |
Definition at line 658 of file dlmalloc.c.
| #define enable_lock | ( | M | ) | ((M)->mflags |= USE_LOCK_BIT) |
Definition at line 2122 of file dlmalloc.c.
| #define enable_mmap | ( | M | ) | ((M)->mflags |= USE_MMAP_BIT) |
Definition at line 2126 of file dlmalloc.c.
| #define EXTERN_BIT (8U) |
Definition at line 1416 of file dlmalloc.c.
| #define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) |
Definition at line 1721 of file dlmalloc.c.
| #define fm gm |
| #define FOOTERS 0 |
Definition at line 499 of file dlmalloc.c.
| #define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) |
Definition at line 1263 of file dlmalloc.c.
| #define get_foot | ( | p, | |
| s | |||
| ) | (((mchunkptr)((char*)(p) + (s)))->prev_foot) |
Definition at line 1743 of file dlmalloc.c.
Definition at line 1970 of file dlmalloc.c.
| #define gm (&_gm_) |
Definition at line 2113 of file dlmalloc.c.
| #define granularity_align | ( | S | ) | (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) |
Definition at line 2142 of file dlmalloc.c.
| #define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) |
Definition at line 1265 of file dlmalloc.c.
| #define HAVE_MMAP 1 |
Definition at line 517 of file dlmalloc.c.
| #define HAVE_MORECORE 1 |
Definition at line 536 of file dlmalloc.c.
| #define HAVE_MREMAP 0 |
Definition at line 526 of file dlmalloc.c.
| #define idx2bit | ( | i | ) | ((binmap_t)(1) << (i)) |
Definition at line 2346 of file dlmalloc.c.
| #define INITIAL_LOCK | ( | l | ) |
Definition at line 1497 of file dlmalloc.c.
| #define INSECURE 0 |
Definition at line 514 of file dlmalloc.c.
Definition at line 3176 of file dlmalloc.c.
Definition at line 3035 of file dlmalloc.c.
Definition at line 2964 of file dlmalloc.c.
| #define internal_free | ( | m, | |
| mem | |||
| ) | dlfree(mem) |
Definition at line 3198 of file dlmalloc.c.
| #define internal_malloc | ( | m, | |
| b | |||
| ) | dlmalloc(b) |
Definition at line 3197 of file dlmalloc.c.
| #define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) |
Definition at line 1718 of file dlmalloc.c.
| #define is_aligned | ( | A | ) | (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) |
Definition at line 1271 of file dlmalloc.c.
| #define is_extern_segment | ( | S | ) | (get_segment_flags(S) & EXTERN_BIT) |
Definition at line 1979 of file dlmalloc.c.
Definition at line 2114 of file dlmalloc.c.
| #define is_granularity_aligned | ( | S | ) | (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) |
Definition at line 2147 of file dlmalloc.c.
Definition at line 2115 of file dlmalloc.c.
| #define is_mmapped | ( | p | ) | (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) |
Definition at line 1754 of file dlmalloc.c.
| #define IS_MMAPPED_BIT (SIZE_T_ZERO) |
Definition at line 1292 of file dlmalloc.c.
| #define is_mmapped_segment | ( | S | ) | (get_segment_flags(S) & IS_MMAPPED_BIT) |
Definition at line 1978 of file dlmalloc.c.
| #define is_page_aligned | ( | S | ) | (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) |
Definition at line 2145 of file dlmalloc.c.
| #define is_small | ( | s | ) | (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) |
Definition at line 2284 of file dlmalloc.c.
| #define least_bit | ( | x | ) | ((x) & -(x)) |
Definition at line 2387 of file dlmalloc.c.
| #define left_bits | ( | x | ) | ((x<<1) | -(x<<1)) |
Definition at line 2390 of file dlmalloc.c.
Definition at line 1876 of file dlmalloc.c.
| #define leftshift_for_tree_index | ( | i | ) |
Definition at line 2333 of file dlmalloc.c.
| #define M_GRANULARITY (-2) |
Definition at line 591 of file dlmalloc.c.
| #define M_MMAP_THRESHOLD (-3) |
Definition at line 592 of file dlmalloc.c.
| #define M_TRIM_THRESHOLD (-1) |
Definition at line 590 of file dlmalloc.c.
| #define MALLINFO_FIELD_TYPE size_t |
Definition at line 580 of file dlmalloc.c.
| #define MALLOC_ALIGNMENT ((size_t)8U) |
Definition at line 496 of file dlmalloc.c.
| #define MALLOC_FAILURE_ACTION errno = ENOMEM; |
Definition at line 530 of file dlmalloc.c.
| #define malloc_getpagesize ((size_t)4096U) |
Definition at line 1240 of file dlmalloc.c.
| #define mark_inuse_foot | ( | M, | |
| p, | |||
| s | |||
| ) |
Definition at line 2464 of file dlmalloc.c.
Definition at line 2349 of file dlmalloc.c.
Definition at line 2353 of file dlmalloc.c.
| #define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) |
Definition at line 1694 of file dlmalloc.c.
| #define MAX_SIZE_T (~(size_t)0) |
Definition at line 483 of file dlmalloc.c.
| #define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) |
Definition at line 2067 of file dlmalloc.c.
| #define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) |
Definition at line 2066 of file dlmalloc.c.
| #define MCHUNK_SIZE (sizeof(mchunk)) |
Definition at line 1670 of file dlmalloc.c.
| #define mem2chunk | ( | mem | ) | ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) |
Definition at line 1689 of file dlmalloc.c.
| #define MFAIL ((void*)(MAX_SIZE_T)) |
Definition at line 1288 of file dlmalloc.c.
| #define MIN_CHUNK_SIZE ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
Definition at line 1684 of file dlmalloc.c.
| #define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) |
Definition at line 2065 of file dlmalloc.c.
| #define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) |
Definition at line 1695 of file dlmalloc.c.
| #define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) |
Definition at line 2287 of file dlmalloc.c.
| #define minsize_for_tree_index | ( | i | ) |
Definition at line 2338 of file dlmalloc.c.
| #define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) |
Definition at line 1679 of file dlmalloc.c.
| #define MMAP_CLEARS 1 |
Definition at line 520 of file dlmalloc.c.
| #define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) |
Definition at line 1681 of file dlmalloc.c.
| #define MORECORE_CONTIGUOUS 0 |
Definition at line 540 of file dlmalloc.c.
| #define MSPACES 0 |
Definition at line 492 of file dlmalloc.c.
| #define next_chunk | ( | p | ) | ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) |
Definition at line 1736 of file dlmalloc.c.
| #define next_pinuse | ( | p | ) | ((next_chunk(p)->head) & PINUSE_BIT) |
Definition at line 1740 of file dlmalloc.c.
| #define NO_MALLINFO 0 |
Definition at line 577 of file dlmalloc.c.
| #define NSMALLBINS (32U) |
Definition at line 2060 of file dlmalloc.c.
| #define NTREEBINS (32U) |
Definition at line 2061 of file dlmalloc.c.
Definition at line 2426 of file dlmalloc.c.
| #define ok_cinuse | ( | p | ) | cinuse(p) |
Definition at line 2430 of file dlmalloc.c.
| #define ok_magic | ( | M | ) | (1) |
Definition at line 2445 of file dlmalloc.c.
| #define ok_next | ( | p, | |
| n | |||
| ) | ((char*)(p) < (char*)(n)) |
Definition at line 2428 of file dlmalloc.c.
| #define ok_pinuse | ( | p | ) | pinuse(p) |
Definition at line 2432 of file dlmalloc.c.
| #define ONLY_MSPACES 0 |
Definition at line 486 of file dlmalloc.c.
| #define overhead_for | ( | p | ) | (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) |
Definition at line 1758 of file dlmalloc.c.
| #define pad_request | ( | req | ) | (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
Definition at line 1698 of file dlmalloc.c.
| #define page_align | ( | S | ) | (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) |
Definition at line 2138 of file dlmalloc.c.
| #define pinuse | ( | p | ) | ((p)->head & PINUSE_BIT) |
Definition at line 1725 of file dlmalloc.c.
| #define PINUSE_BIT (SIZE_T_ONE) |
Definition at line 1716 of file dlmalloc.c.
| #define POSTACTION | ( | M | ) |
Definition at line 2213 of file dlmalloc.c.
| #define PREACTION | ( | M | ) | (0) |
Definition at line 2209 of file dlmalloc.c.
| #define prev_chunk | ( | p | ) | ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) |
Definition at line 1737 of file dlmalloc.c.
| #define PROCEED_ON_ERROR 0 |
Definition at line 508 of file dlmalloc.c.
| #define RELEASE_MAGIC_INIT_LOCK | ( | ) |
Definition at line 1513 of file dlmalloc.c.
| #define RELEASE_MORECORE_LOCK | ( | ) |
Definition at line 1505 of file dlmalloc.c.
| #define request2size | ( | req | ) | (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) |
Definition at line 1702 of file dlmalloc.c.
| #define RTCHECK | ( | e | ) | __builtin_expect(e, 1) |
Definition at line 2452 of file dlmalloc.c.
| #define same_or_left_bits | ( | x | ) | ((x) | -(x)) |
Definition at line 2393 of file dlmalloc.c.
Definition at line 2151 of file dlmalloc.c.
| #define set_foot | ( | p, | |
| s | |||
| ) | (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) |
Definition at line 1744 of file dlmalloc.c.
| #define set_free_with_pinuse | ( | p, | |
| s, | |||
| n | |||
| ) | (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) |
Definition at line 1751 of file dlmalloc.c.
| #define set_inuse | ( | M, | |
| p, | |||
| s | |||
| ) |
Definition at line 2467 of file dlmalloc.c.
| #define set_inuse_and_pinuse | ( | M, | |
| p, | |||
| s | |||
| ) |
Definition at line 2472 of file dlmalloc.c.
Definition at line 2132 of file dlmalloc.c.
Definition at line 1971 of file dlmalloc.c.
| #define set_size_and_pinuse_of_free_chunk | ( | p, | |
| s | |||
| ) | ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) |
Definition at line 1747 of file dlmalloc.c.
| #define set_size_and_pinuse_of_inuse_chunk | ( | M, | |
| p, | |||
| s | |||
| ) | ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) |
Definition at line 2477 of file dlmalloc.c.
Definition at line 2177 of file dlmalloc.c.
| #define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) |
Definition at line 1264 of file dlmalloc.c.
| #define SIZE_T_BITSIZE (sizeof(size_t) << 3) |
Definition at line 1255 of file dlmalloc.c.
| #define SIZE_T_ONE ((size_t)1) |
Definition at line 1260 of file dlmalloc.c.
| #define SIZE_T_SIZE (sizeof(size_t)) |
Definition at line 1254 of file dlmalloc.c.
| #define SIZE_T_TWO ((size_t)2) |
Definition at line 1261 of file dlmalloc.c.
| #define SIZE_T_ZERO ((size_t)0) |
Definition at line 1259 of file dlmalloc.c.
| #define small_index | ( | s | ) | ((s) >> SMALLBIN_SHIFT) |
Definition at line 2285 of file dlmalloc.c.
| #define small_index2size | ( | i | ) | ((i) << SMALLBIN_SHIFT) |
Definition at line 2286 of file dlmalloc.c.
Definition at line 2290 of file dlmalloc.c.
| #define SMALLBIN_SHIFT (3U) |
Definition at line 2062 of file dlmalloc.c.
| #define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) |
Definition at line 2063 of file dlmalloc.c.
Definition at line 2351 of file dlmalloc.c.
| #define TOP_FOOT_SIZE (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) |
Definition at line 2187 of file dlmalloc.c.
Definition at line 2291 of file dlmalloc.c.
| #define TREEBIN_SHIFT (8U) |
Definition at line 2064 of file dlmalloc.c.
Definition at line 2355 of file dlmalloc.c.
| #define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) |
Definition at line 1262 of file dlmalloc.c.
Definition at line 3180 of file dlmalloc.c.
Definition at line 3003 of file dlmalloc.c.
| #define unlink_large_chunk | ( | M, | |
| X | |||
| ) |
Definition at line 3103 of file dlmalloc.c.
Definition at line 2983 of file dlmalloc.c.
| #define USAGE_ERROR_ACTION | ( | m, | |
| p | |||
| ) | ABORT |
Definition at line 2244 of file dlmalloc.c.
| #define USE_BUILTIN_FFS 0 |
Definition at line 571 of file dlmalloc.c.
| #define USE_DEV_RANDOM 0 |
Definition at line 574 of file dlmalloc.c.
| #define use_lock | ( | M | ) | ((M)->mflags & USE_LOCK_BIT) |
Definition at line 2121 of file dlmalloc.c.
| #define USE_LOCK_BIT (0U) |
Definition at line 1496 of file dlmalloc.c.
| #define USE_LOCKS 0 |
Definition at line 511 of file dlmalloc.c.
| #define use_mmap | ( | M | ) | ((M)->mflags & USE_MMAP_BIT) |
Definition at line 2125 of file dlmalloc.c.
| #define USE_MMAP_BIT (SIZE_T_ZERO) |
Definition at line 1293 of file dlmalloc.c.
| #define use_noncontiguous | ( | M | ) | ((M)->mflags & USE_NONCONTIGUOUS_BIT) |
Definition at line 2129 of file dlmalloc.c.
| #define USE_NONCONTIGUOUS_BIT (4U) |
Definition at line 1413 of file dlmalloc.c.
| typedef size_t bindex_t |
Definition at line 1664 of file dlmalloc.c.
Definition at line 1665 of file dlmalloc.c.
Definition at line 1666 of file dlmalloc.c.
| typedef struct malloc_chunk mchunk |
Definition at line 1661 of file dlmalloc.c.
| typedef struct malloc_chunk* mchunkptr |
Definition at line 1662 of file dlmalloc.c.
| typedef struct malloc_segment msegment |
Definition at line 1981 of file dlmalloc.c.
| typedef struct malloc_segment* msegmentptr |
Definition at line 1982 of file dlmalloc.c.
| typedef struct malloc_state* mstate |
Definition at line 2090 of file dlmalloc.c.
| typedef struct malloc_chunk* sbinptr |
Definition at line 1663 of file dlmalloc.c.
| typedef struct malloc_tree_chunk* tbinptr |
Definition at line 1873 of file dlmalloc.c.
| typedef struct malloc_tree_chunk tchunk |
Definition at line 1871 of file dlmalloc.c.
| typedef struct malloc_tree_chunk* tchunkptr |
Definition at line 1872 of file dlmalloc.c.
| void * dlcalloc | ( | size_t | n_elements, |
| size_t | elem_size | ||
| ) |
Definition at line 4355 of file dlmalloc.c.
References calloc_must_clear, dlmalloc, MAX_SIZE_T, and mem2chunk.
| void dlfree | ( | void * | mem | ) |
Definition at line 4255 of file dlmalloc.c.
References CALL_MUNMAP, check_free_chunk, check_inuse_chunk, chunk_minus_offset, chunk_plus_offset, chunksize, cinuse, fm, malloc_chunk::head, insert_chunk, INUSE_BITS, IS_MMAPPED_BIT, mem2chunk, MMAP_FOOT_PAD, ok_address, ok_cinuse, ok_magic, ok_next, ok_pinuse, pinuse, PINUSE_BIT, POSTACTION, PREACTION, malloc_chunk::prev_foot, RTCHECK, set_free_with_pinuse, set_size_and_pinuse_of_free_chunk, should_trim, unlink_chunk, and USAGE_ERROR_ACTION.
| void ** dlindependent_calloc | ( | size_t | n_elements, |
| size_t | elem_size, | ||
| void * | chunks[] | ||
| ) |
Definition at line 4397 of file dlmalloc.c.
References gm.
| void ** dlindependent_calloc | ( | size_t | , |
| size_t | , | ||
| void ** | |||
| ) |
| void ** dlindependent_comalloc | ( | size_t | n_elements, |
| size_t | sizes[], | ||
| void * | chunks[] | ||
| ) |
Definition at line 4403 of file dlmalloc.c.
References gm.
| void ** dlindependent_comalloc | ( | size_t | , |
| size_t * | , | ||
| void ** | |||
| ) |
| void * dlmalloc | ( | size_t | bytes | ) |
Definition at line 4123 of file dlmalloc.c.
References assert, check_malloced_chunk, check_top_chunk, chunk2mem, chunk_plus_offset, chunksize, compute_bit2idx, malloc_chunk::fd, gm, malloc_chunk::head, idx2bit, least_bit, left_bits, MAX_REQUEST, MAX_SIZE_T, MAX_SMALL_REQUEST, MIN_CHUNK_SIZE, MIN_REQUEST, pad_request, PINUSE_BIT, POSTACTION, PREACTION, replace_dv, set_inuse_and_pinuse, set_size_and_pinuse_of_free_chunk, set_size_and_pinuse_of_inuse_chunk, SIZE_T_SIZE, small_index, small_index2size, smallbin_at, and unlink_first_small_chunk.
| int dlmalloc_trim | ( | size_t | pad | ) |
Definition at line 4422 of file dlmalloc.c.
References gm, POSTACTION, and PREACTION.
| size_t dlmalloc_usable_size | ( | void * | mem | ) |
Definition at line 4449 of file dlmalloc.c.
References chunksize, cinuse, mem2chunk, and overhead_for.
Definition at line 4458 of file dlmalloc.c.
| void * dlmemalign | ( | size_t | alignment, |
| size_t | bytes | ||
| ) |
Definition at line 4393 of file dlmalloc.c.
References gm.
| void * dlpvalloc | ( | size_t | bytes | ) |
Definition at line 4415 of file dlmalloc.c.
References dlmemalign, malloc_params::page_size, and SIZE_T_ONE.
| void * dlrealloc | ( | void * | oldmem, |
| size_t | bytes | ||
| ) |
Definition at line 4370 of file dlmalloc.c.
References dlfree, dlmalloc, gm, mem2chunk, ok_magic, and USAGE_ERROR_ACTION.
| void * dlvalloc | ( | size_t | bytes | ) |
Definition at line 4408 of file dlmalloc.c.
References dlmemalign, and malloc_params::page_size.