Files | |
file | malloc.c |
Data Structures | |
struct | malloc_chunk |
struct | malloc_tree_chunk |
struct | malloc_segment |
struct | malloc_state |
struct | malloc_params |
Defines | |
#define | LACKS_FCNTL_H |
#define | LACKS_SYS_MMAN_H |
#define | LACKS_SYS_PARAM_H |
#define | HAVE_MMAP 0 |
#define | HAVE_MMAP 0 |
#define | LACKS_ERRNO_H |
#define | MALLOC_FAILURE_ACTION |
#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 1 |
#define | INSECURE 0 |
#define | MMAP_CLEARS 1 |
#define | HAVE_MORECORE 1 |
#define | MORECORE_CONTIGUOUS 1 |
#define | MORECORE sbrk |
#define | DEFAULT_GRANULARITY (0) |
#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 | 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)) |
#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) MORECORE(S) |
#define | USE_NONCONTIGUOUS_BIT (4U) |
#define | EXTERN_BIT (8U) |
#define | MLOCK_T atomic_t |
#define | INITIAL_LOCK(l) futex_initialize(l, 1) |
#define | ACQUIRE_LOCK(l) ({futex_down(l);0;}) |
#define | RELEASE_LOCK(l) futex_up(l) |
#define | USE_LOCK_BIT (2U) |
#define | ACQUIRE_MORECORE_LOCK() ACQUIRE_LOCK(&morecore_mutex); |
#define | RELEASE_MORECORE_LOCK() RELEASE_LOCK(&morecore_mutex); |
#define | ACQUIRE_MAGIC_INIT_LOCK() ACQUIRE_LOCK(&magic_init_mutex); |
#define | RELEASE_MAGIC_INIT_LOCK() RELEASE_LOCK(&magic_init_mutex); |
#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) (!is_mmapped(p)) |
#define | leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) |
#define | is_mmapped_segment(S) ((S)->sflags & IS_MMAPPED_BIT) |
#define | is_extern_segment(S) ((S)->sflags & 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 | GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams()) |
#define | PREACTION(M) ((GLOBALLY_INITIALIZE() || use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0) |
#define | POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); } |
#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) (e) |
#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) |
Typedefs | |
typedef malloc_chunk | mchunk |
typedef malloc_chunk * | mchunkptr |
typedef malloc_chunk * | sbinptr |
typedef unsigned int | bindex_t |
typedef unsigned int | binmap_t |
typedef unsigned int | flag_t |
typedef malloc_tree_chunk | tchunk |
typedef malloc_tree_chunk * | tchunkptr |
typedef malloc_tree_chunk * | tbinptr |
typedef malloc_segment | msegment |
typedef malloc_segment * | msegmentptr |
typedef malloc_state * | mstate |
Functions | |
static msegmentptr | segment_holding (mstate m, char *addr) |
static int | has_segment_link (mstate m, msegmentptr ss) |
static int | init_mparams (void) |
static int | change_mparam (int param_number, int value) |
static struct mallinfo | internal_mallinfo (mstate m) |
static void | internal_malloc_stats (mstate m) |
static void * | mmap_alloc (mstate m, size_t nb) |
static mchunkptr | mmap_resize (mstate m, mchunkptr oldp, size_t nb) |
static void | init_top (mstate m, mchunkptr p, size_t psize) |
static void | init_bins (mstate m) |
static void * | prepend_alloc (mstate m, char *newbase, char *oldbase, size_t nb) |
static void | add_segment (mstate m, char *tbase, size_t tsize, flag_t mmapped) |
static void * | sys_alloc (mstate m, size_t nb) |
static size_t | release_unused_segments (mstate m) |
static int | sys_trim (mstate m, size_t pad) |
static void * | tmalloc_large (mstate m, size_t nb) |
static void * | tmalloc_small (mstate m, size_t nb) |
static void * | internal_realloc (mstate m, void *oldmem, size_t bytes) |
static void * | internal_memalign (mstate m, size_t alignment, size_t bytes) |
static void ** | ialloc (mstate m, size_t n_elements, size_t *sizes, int opts, void *chunks[]) |
void * | dlmalloc (size_t bytes) |
void | dlfree (void *mem) |
void * | dlcalloc (size_t n_elements, size_t elem_size) |
void * | dlrealloc (void *oldmem, size_t bytes) |
void * | dlmemalign (size_t alignment, size_t bytes) |
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[]) |
void * | dlvalloc (size_t bytes) |
void * | dlpvalloc (size_t bytes) |
int | dlmalloc_trim (size_t pad) |
size_t | dlmalloc_footprint (void) |
size_t | dlmalloc_max_footprint (void) |
mallinfo | dlmallinfo (void) |
void | dlmalloc_stats () |
size_t | dlmalloc_usable_size (void *mem) |
int | dlmallopt (int param_number, int value) |
Variables | |
static MLOCK_T | morecore_mutex = FUTEX_INITIALIZER |
static MLOCK_T | magic_init_mutex = FUTEX_INITIALIZER |
static struct malloc_params | mparams |
static struct malloc_state | _gm_ |
|
Non-default helenos customizations |
|
|
|
|
|
Definition at line 481 of file malloc.c. Referenced by sys_trim(). |
|
|
|
|
|
Definition at line 461 of file malloc.c. Referenced by internal_memalign(), and internal_realloc(). |
|
Definition at line 464 of file malloc.c. Referenced by dlcalloc(), dlmalloc(), init_mparams(), and sys_trim(). |
|
|
|
|
|
Definition at line 472 of file malloc.c. Referenced by init_mparams(), and internal_memalign(). |
|
|
|
Definition at line 476 of file malloc.c. Referenced by init_mparams(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 485 of file malloc.c. Referenced by sys_trim(). |
|
Definition at line 486 of file malloc.c. Referenced by sys_alloc(). |
|
|
|
Definition at line 488 of file malloc.c. Referenced by init_mparams(). |
|
Definition at line 492 of file malloc.c. Referenced by init_mparams(). |
|
Definition at line 501 of file malloc.c. Referenced by init_mparams(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 620 of file malloc.c. Referenced by init_mparams(). |
|
Definition at line 634 of file malloc.c. Referenced by add_segment(), dlmalloc(), ialloc(), mmap_alloc(), and mmap_resize(). |
|
Definition at line 635 of file malloc.c. Referenced by tmalloc_large(). |
|
|
|
Definition at line 640 of file malloc.c. Referenced by init_mparams(), internal_mallinfo(), and sys_alloc(). |
|
|
|
|
|
Definition at line 643 of file malloc.c. Referenced by add_segment(). |
|
Definition at line 644 of file malloc.c. Referenced by mmap_alloc(), and mmap_resize(). |
|
Definition at line 645 of file malloc.c. Referenced by sys_alloc(), and sys_trim(). |
|
Definition at line 648 of file malloc.c. Referenced by add_segment(), mmap_alloc(), and mmap_resize(). |
|
Definition at line 651 of file malloc.c. Referenced by add_segment(), and mmap_alloc(). |
|
Value: ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\ ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK)) Definition at line 654 of file malloc.c. Referenced by add_segment(), init_top(), and mmap_alloc(). |
|
Definition at line 668 of file malloc.c. Referenced by sys_trim(). |
|
Definition at line 669 of file malloc.c. Referenced by mmap_alloc(), mmap_resize(), sys_alloc(), and sys_trim(). |
|
Definition at line 672 of file malloc.c. Referenced by dlfree(), mmap_alloc(), and mmap_resize(). |
|
Definition at line 673 of file malloc.c. Referenced by init_mparams(). |
|
|
|
Definition at line 675 of file malloc.c. Referenced by dlfree(), release_unused_segments(), and sys_trim(). |
|
Definition at line 676 of file malloc.c. Referenced by mmap_alloc(). |
|
Definition at line 747 of file malloc.c. Referenced by mmap_resize(), and sys_trim(). |
|
Definition at line 751 of file malloc.c. Referenced by sys_alloc(), and sys_trim(). |
|
Definition at line 757 of file malloc.c. Referenced by init_mparams(). |
|
|
|
|
|
Definition at line 784 of file malloc.c. Referenced by init_mparams(). |
|
|
|
|
|
Definition at line 798 of file malloc.c. Referenced by init_mparams(). |
|
Definition at line 805 of file malloc.c. Referenced by sys_alloc(), and sys_trim(). |
|
Definition at line 806 of file malloc.c. Referenced by sys_alloc(), and sys_trim(). |
|
Definition at line 813 of file malloc.c. Referenced by init_mparams(). |
|
Definition at line 814 of file malloc.c. Referenced by init_mparams(). |
|
Definition at line 974 of file malloc.c. Referenced by init_mparams(). |
|
Definition at line 979 of file malloc.c. Referenced by ialloc(), and internal_memalign(). |
|
|
|
Definition at line 985 of file malloc.c. Referenced by dlfree(), mmap_alloc(), and mmap_resize(). |
|
Definition at line 988 of file malloc.c. Referenced by add_segment(), dlmalloc(), init_mparams(), internal_memalign(), internal_realloc(), prepend_alloc(), and tmalloc_small(). |
|
Definition at line 992 of file malloc.c. Referenced by add_segment(), dlmalloc(), ialloc(), init_top(), internal_memalign(), internal_realloc(), mmap_alloc(), prepend_alloc(), and tmalloc_small(). |
|
Definition at line 993 of file malloc.c. Referenced by dlcalloc(), dlfree(), dlmalloc_usable_size(), dlrealloc(), ialloc(), internal_memalign(), and internal_realloc(). |
|
Definition at line 995 of file malloc.c. Referenced by internal_mallinfo(), internal_malloc_stats(), prepend_alloc(), and release_unused_segments(). |
|
Definition at line 998 of file malloc.c. Referenced by dlmalloc(), internal_memalign(), internal_realloc(), and sys_trim(). |
|
Definition at line 999 of file malloc.c. Referenced by dlmalloc(). |
|
Definition at line 1002 of file malloc.c. Referenced by add_segment(), and dlmalloc(). |
|
Definition at line 1006 of file malloc.c. Referenced by ialloc(), internal_memalign(), and internal_realloc(). |
|
Definition at line 1020 of file malloc.c. Referenced by dlfree(), dlmalloc(), init_top(), internal_realloc(), and prepend_alloc(). |
|
Definition at line 1021 of file malloc.c. Referenced by internal_memalign(), mmap_alloc(), and mmap_resize(). |
|
Definition at line 1022 of file malloc.c. Referenced by dlfree(). |
|
Definition at line 1025 of file malloc.c. Referenced by add_segment(), internal_mallinfo(), internal_malloc_stats(), mmap_alloc(), and mmap_resize(). |
|
Definition at line 1028 of file malloc.c. Referenced by dlfree(), dlmalloc_usable_size(), internal_mallinfo(), internal_malloc_stats(), prepend_alloc(), and release_unused_segments(). |
|
Definition at line 1029 of file malloc.c. Referenced by dlfree(), and prepend_alloc(). |
|
Definition at line 1030 of file malloc.c. Referenced by dlfree(), dlmalloc(), dlmalloc_usable_size(), ialloc(), internal_mallinfo(), internal_malloc_stats(), internal_memalign(), internal_realloc(), mmap_resize(), prepend_alloc(), release_unused_segments(), tmalloc_large(), and tmalloc_small(). |
|
|
|
|
|
Definition at line 1036 of file malloc.c. Referenced by add_segment(), dlfree(), dlmalloc(), ialloc(), init_top(), internal_memalign(), internal_realloc(), mmap_alloc(), mmap_resize(), prepend_alloc(), and tmalloc_small(). |
|
Definition at line 1037 of file malloc.c. Referenced by dlfree(). |
|
Definition at line 1040 of file malloc.c. Referenced by internal_mallinfo(), and internal_malloc_stats(). |
|
|
|
|
|
|
|
|
|
Definition at line 1051 of file malloc.c. Referenced by dlfree(), dlmalloc(), prepend_alloc(), and tmalloc_small(). |
|
Definition at line 1055 of file malloc.c. Referenced by dlfree(), and prepend_alloc(). |
|
Definition at line 1058 of file malloc.c. Referenced by ialloc(), internal_memalign(), and internal_realloc(). |
|
Definition at line 1062 of file malloc.c. Referenced by dlmalloc_usable_size(), and internal_realloc(). |
|
Definition at line 1067 of file malloc.c. Referenced by dlcalloc(). |
|
Definition at line 1180 of file malloc.c. Referenced by tmalloc_small(). |
|
Definition at line 1246 of file malloc.c. Referenced by release_unused_segments(), and sys_trim(). |
|
Definition at line 1247 of file malloc.c. Referenced by release_unused_segments(), and sys_trim(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1335 of file malloc.c. Referenced by dlmalloc(). |
|
Definition at line 1381 of file malloc.c. Referenced by dlindependent_calloc(), dlindependent_comalloc(), dlmallinfo(), dlmalloc(), dlmalloc_footprint(), dlmalloc_max_footprint(), dlmalloc_stats(), dlmalloc_trim(), dlmemalign(), dlrealloc(), and init_mparams(). |
|
|
|
Definition at line 1383 of file malloc.c. Referenced by internal_mallinfo(), internal_malloc_stats(), and sys_trim(). |
|
|
|
|
|
|
|
Definition at line 1393 of file malloc.c. Referenced by ialloc(), and sys_alloc(). |
|
Definition at line 1394 of file malloc.c. Referenced by ialloc(). |
|
Definition at line 1395 of file malloc.c. Referenced by ialloc(). |
|
Definition at line 1397 of file malloc.c. Referenced by sys_alloc(). |
|
Definition at line 1398 of file malloc.c. Referenced by sys_alloc(). |
|
Value: ((M)->mflags = (L)?\ ((M)->mflags | USE_LOCK_BIT) :\ ((M)->mflags & ~USE_LOCK_BIT)) |
|
Definition at line 1406 of file malloc.c. Referenced by sys_alloc(). |
|
Definition at line 1410 of file malloc.c. Referenced by mmap_alloc(), mmap_resize(), and sys_alloc(). |
|
Definition at line 1413 of file malloc.c. Referenced by sys_alloc(). |
|
|
|
Definition at line 1419 of file malloc.c. Referenced by internal_mallinfo(), internal_malloc_stats(), and release_unused_segments(). |
|
Definition at line 1445 of file malloc.c. Referenced by dlfree(). |
|
Definition at line 1455 of file malloc.c. Referenced by add_segment(), init_top(), internal_mallinfo(), internal_malloc_stats(), release_unused_segments(), sys_alloc(), and sys_trim(). |
|
|
|
Definition at line 1472 of file malloc.c. Referenced by dlfree(), dlmalloc(), dlmalloc_trim(), ialloc(), internal_mallinfo(), internal_malloc_stats(), internal_memalign(), and internal_realloc(). |
|
Definition at line 1473 of file malloc.c. Referenced by dlfree(), dlmalloc(), dlmalloc_trim(), internal_mallinfo(), internal_malloc_stats(), internal_memalign(), and internal_realloc(). |
|
Definition at line 1508 of file malloc.c. Referenced by tmalloc_small(). |
|
Definition at line 1512 of file malloc.c. Referenced by dlfree(), dlrealloc(), and internal_realloc(). |
|
Definition at line 1521 of file malloc.c. Referenced by dlfree(), and prepend_alloc(). |
|
Definition at line 1522 of file malloc.c. Referenced by dlfree(), internal_memalign(), and internal_realloc(). |
|
Definition at line 1523 of file malloc.c. Referenced by dlmalloc(), and prepend_alloc(). |
|
Definition at line 1524 of file malloc.c. Referenced by mmap_alloc(), and mmap_resize(). |
|
Definition at line 1525 of file malloc.c. Referenced by internal_mallinfo(), and internal_malloc_stats(). |
|
Definition at line 1526 of file malloc.c. Referenced by dlmalloc(), prepend_alloc(), and sys_trim(). |
|
Definition at line 1552 of file malloc.c. Referenced by mmap_resize(). |
|
Definition at line 1553 of file malloc.c. Referenced by dlmalloc(). |
|
Definition at line 1554 of file malloc.c. Referenced by dlmalloc(). |
|
|
|
Definition at line 1558 of file malloc.c. Referenced by dlmalloc(), and init_bins(). |
|
Definition at line 1559 of file malloc.c. Referenced by tmalloc_large(), and tmalloc_small(). |
|
Value: {\ size_t X = S >> TREEBIN_SHIFT;\ if (X == 0)\ I = 0;\ else if (X > 0xFFFF)\ I = NTREEBINS-1;\ else {\ unsigned int Y = (unsigned int)X;\ unsigned int N = ((Y - 0x100) >> 16) & 8;\ unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\ N += K;\ N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\ K = 14 - N + ((Y <<= K) >> 15);\ I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\ }\ } Definition at line 1577 of file malloc.c. Referenced by tmalloc_large(). |
|
|
|
Value: ((i == NTREEBINS-1)? 0 : \ ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2))) Definition at line 1601 of file malloc.c. Referenced by tmalloc_large(). |
|
Value: ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) |
|
Definition at line 1614 of file malloc.c. Referenced by dlmalloc(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
Value: {\ unsigned int Y = X - 1;\ unsigned int K = Y >> (16-4) & 16;\ unsigned int N = K; Y >>= K;\ N += K = Y >> (8-3) & 8; Y >>= K;\ N += K = Y >> (4-2) & 4; Y >>= K;\ N += K = Y >> (2-1) & 2; Y >>= K;\ N += K = Y >> (1-0) & 1; Y >>= K;\ I = (bindex_t)(N + Y);\ } Definition at line 1640 of file malloc.c. Referenced by dlmalloc(), and tmalloc_small(). |
|
Definition at line 1655 of file malloc.c. Referenced by dlmalloc(), and tmalloc_small(). |
|
Definition at line 1658 of file malloc.c. Referenced by dlmalloc(). |
|
|
|
Definition at line 1694 of file malloc.c. Referenced by dlfree(), internal_realloc(), and tmalloc_small(). |
|
Definition at line 1696 of file malloc.c. Referenced by dlfree(), internal_realloc(), and tmalloc_small(). |
|
Definition at line 1698 of file malloc.c. Referenced by dlfree(), and internal_realloc(). |
|
Definition at line 1700 of file malloc.c. Referenced by dlfree(), and internal_realloc(). |
|
Definition at line 1713 of file malloc.c. Referenced by dlfree(), and dlrealloc(). |
|
Definition at line 1722 of file malloc.c. Referenced by dlfree(), internal_realloc(), and tmalloc_small(). |
|
Definition at line 1732 of file malloc.c. Referenced by mmap_alloc(), and mmap_resize(). |
|
Value: ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) Definition at line 1735 of file malloc.c. Referenced by internal_memalign(), and internal_realloc(). |
|
Value: ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) Definition at line 1740 of file malloc.c. Referenced by dlmalloc(), and tmalloc_small(). |
|
Definition at line 1745 of file malloc.c. Referenced by add_segment(), dlmalloc(), ialloc(), prepend_alloc(), and tmalloc_small(). |
|
Value: {\ bindex_t I = small_index(S);\ mchunkptr B = smallbin_at(M, I);\ mchunkptr F = B;\ assert(S >= MIN_CHUNK_SIZE);\ if (!smallmap_is_marked(M, I))\ mark_smallmap(M, I);\ else if (RTCHECK(ok_address(M, B->fd)))\ F = B->fd;\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ B->fd = P;\ F->bk = P;\ P->fd = F;\ P->bk = B;\ } |
|
Value: {\ mchunkptr F = P->fd;\ mchunkptr B = P->bk;\ bindex_t I = small_index(S);\ assert(P != B);\ assert(P != F);\ assert(chunksize(P) == small_index2size(I));\ if (F == B)\ clear_smallmap(M, I);\ else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\ (B == smallbin_at(M,I) || ok_address(M, B)))) {\ F->bk = B;\ B->fd = F;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ } |
|
Value: {\ mchunkptr F = P->fd;\ assert(P != B);\ assert(P != F);\ assert(chunksize(P) == small_index2size(I));\ if (B == F)\ clear_smallmap(M, I);\ else if (RTCHECK(ok_address(M, F))) {\ B->fd = F;\ F->bk = B;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ } Definition at line 2266 of file malloc.c. Referenced by dlmalloc(). |
|
Value: {\ size_t DVS = M->dvsize;\ if (DVS != 0) {\ mchunkptr DV = M->dv;\ assert(is_small(DVS));\ insert_small_chunk(M, DV, DVS);\ }\ M->dvsize = S;\ M->dv = P;\ } Definition at line 2284 of file malloc.c. Referenced by dlmalloc(), and tmalloc_small(). |
|
Definition at line 2298 of file malloc.c. Referenced by release_unused_segments(). |
|
Definition at line 2366 of file malloc.c. Referenced by release_unused_segments(), and tmalloc_small(). |
|
Value: if (is_small(S)) insert_small_chunk(M, P, S)\ else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); } Definition at line 2439 of file malloc.c. Referenced by dlfree(), and prepend_alloc(). |
|
Value: if (is_small(S)) unlink_small_chunk(M, P, S)\ else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); } Definition at line 2443 of file malloc.c. Referenced by dlfree(), and prepend_alloc(). |
|
Definition at line 2460 of file malloc.c. Referenced by ialloc(), internal_memalign(), and internal_realloc(). |
|
Definition at line 2461 of file malloc.c. Referenced by internal_memalign(), and internal_realloc(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1423 of file malloc.c. References malloc_state::seg, and sp. Referenced by add_segment(), sys_alloc(), and sys_trim(). |
|
Definition at line 1434 of file malloc.c. References malloc_segment::base, malloc_state::seg, malloc_segment::size, and sp. Referenced by sys_trim(). |
|
Definition at line 1777 of file malloc.c. References ABORT, ACQUIRE_MAGIC_INIT_LOCK, DEFAULT_GRANULARITY, malloc_params::default_mflags, DEFAULT_MMAP_THRESHOLD, DEFAULT_TRIM_THRESHOLD, gm, malloc_params::granularity, INITIAL_LOCK, malloc_params::magic, MALLOC_ALIGNMENT, malloc_getpagesize, MAX_SIZE_T, MCHUNK_SIZE, MIN_CHUNK_SIZE, malloc_params::mmap_threshold, mparams, open(), malloc_params::page_size, read(), RELEASE_MAGIC_INIT_LOCK, SIZE_T_ONE, malloc_params::trim_threshold, USE_LOCK_BIT, USE_MMAP_BIT, and USE_NONCONTIGUOUS_BIT. Referenced by change_mparam(), dlpvalloc(), dlvalloc(), and sys_alloc(). Here is the call graph for this function: |
|
Definition at line 1853 of file malloc.c. References malloc_params::granularity, init_mparams(), M_GRANULARITY, M_MMAP_THRESHOLD, M_TRIM_THRESHOLD, malloc_params::mmap_threshold, mparams, malloc_params::page_size, and malloc_params::trim_threshold. Referenced by dlmallopt(). Here is the call graph for this function: |
|
Definition at line 2146 of file malloc.c. References align_as_chunk, mallinfo::arena, malloc_segment::base, check_malloc_state, chunksize, cinuse, FENCEPOST_HEAD, mallinfo::fordblks, mallinfo::hblkhd, malloc_chunk::head, is_initialized, mallinfo::keepcost, malloc_segment::next, next_chunk, mallinfo::ordblks, POSTACTION, PREACTION, segment_holds, SIZE_T_ONE, TOP_FOOT_SIZE, mallinfo::uordblks, and mallinfo::usmblks. Referenced by dlmallinfo(). |
|
Definition at line 2185 of file malloc.c. References align_as_chunk, malloc_segment::base, check_malloc_state, chunksize, cinuse, FENCEPOST_HEAD, malloc_state::footprint, fprintf, malloc_chunk::head, is_initialized, malloc_state::max_footprint, malloc_segment::next, next_chunk, POSTACTION, PREACTION, malloc_state::seg, segment_holds, malloc_state::top, TOP_FOOT_SIZE, and malloc_state::topsize. Referenced by dlmalloc_stats(). |
|
Definition at line 2478 of file malloc.c. References align_offset, assert, check_mmapped_chunk, chunk2mem, CHUNK_ALIGN_MASK, chunk_plus_offset, CINUSE_BIT, CMFAIL, DIRECT_MMAP, FENCEPOST_HEAD, malloc_state::footprint, granularity_align, is_aligned, IS_MMAPPED_BIT, malloc_state::least_addr, mark_inuse_foot, malloc_state::max_footprint, MMAP_FOOT_PAD, malloc_chunk::prev_foot, SIX_SIZE_T_SIZES, and SIZE_T_SIZE. Referenced by sys_alloc(). |
|
Definition at line 2505 of file malloc.c. References CALL_MREMAP, check_mmapped_chunk, CHUNK_ALIGN_MASK, chunk_plus_offset, chunksize, CINUSE_BIT, CMFAIL, FENCEPOST_HEAD, malloc_state::footprint, malloc_params::granularity, granularity_align, malloc_chunk::head, IS_MMAPPED_BIT, is_small, malloc_state::least_addr, mark_inuse_foot, malloc_state::max_footprint, MMAP_FOOT_PAD, mparams, malloc_chunk::prev_foot, SIX_SIZE_T_SIZES, and SIZE_T_SIZE. Referenced by internal_realloc(). |
|
Definition at line 2542 of file malloc.c. References align_offset, chunk2mem, chunk_plus_offset, malloc_chunk::head, mparams, PINUSE_BIT, malloc_state::top, TOP_FOOT_SIZE, malloc_state::topsize, malloc_state::trim_check, and malloc_params::trim_threshold. Referenced by add_segment(), and sys_trim(). |
|
Definition at line 2557 of file malloc.c. References smallbin_at. |
|
|
Definition at line 2629 of file malloc.c. References align_offset, assert, malloc_segment::base, chunk2mem, CHUNK_ALIGN_MASK, chunk_plus_offset, FENCEPOST_HEAD, FOUR_SIZE_T_SIZES, malloc_chunk::head, init_top(), is_aligned, MIN_CHUNK_SIZE, malloc_segment::next, pad_request, malloc_state::seg, segment_holding(), set_size_and_pinuse_of_inuse_chunk, malloc_segment::sflags, malloc_segment::size, SIZE_T_SIZE, sp, malloc_state::top, and TOP_FOOT_SIZE. Here is the call graph for this function: |
|
Definition at line 2684 of file malloc.c. References ACQUIRE_MORECORE_LOCK, CALL_MORECORE, CMFAIL, disable_contiguous, granularity_align, HALF_MAX_SIZE_T, init_mparams(), is_page_aligned, mmap_alloc(), malloc_params::mmap_threshold, MORECORE_CONTIGUOUS, mparams, page_align, RELEASE_MORECORE_LOCK, segment_holding(), SIZE_T_ONE, malloc_state::top, TOP_FOOT_SIZE, malloc_state::topsize, use_mmap, and use_noncontiguous. Referenced by dlmalloc(). Here is the call graph for this function: |
|
Definition at line 2876 of file malloc.c. References align_as_chunk, assert, CALL_MUNMAP, chunksize, cinuse, malloc_state::dv, malloc_state::dvsize, malloc_state::footprint, insert_large_chunk, is_extern_segment, is_mmapped_segment, malloc_segment::next, malloc_state::seg, segment_holds, sp, TOP_FOOT_SIZE, and unlink_large_chunk. Referenced by sys_trim(). |
|
Definition at line 2916 of file malloc.c. References ACQUIRE_MORECORE_LOCK, CALL_MORECORE, CALL_MREMAP, CALL_MUNMAP, check_top_chunk, CMFAIL, malloc_state::footprint, malloc_params::granularity, HALF_MAX_SIZE_T, has_segment_link(), HAVE_MMAP, HAVE_MORECORE, init_top(), is_extern_segment, is_initialized, is_mmapped_segment, MAX_REQUEST, MAX_SIZE_T, MFAIL, mparams, RELEASE_MORECORE_LOCK, release_unused_segments(), segment_holding(), sp, malloc_state::top, TOP_FOOT_SIZE, malloc_state::topsize, and malloc_state::trim_check. Referenced by dlfree(), and dlmalloc_trim(). Here is the call graph for this function: |
|
Definition at line 2981 of file malloc.c. References malloc_tree_chunk::child, chunksize, compute_tree_index, leftshift_for_tree_index, SIZE_T_BITSIZE, and treebin_at. Referenced by dlmalloc(). |
|
Definition at line 3054 of file malloc.c. References assert, chunk2mem, chunk_plus_offset, chunksize, compute_bit2idx, CORRUPTION_ERROR_ACTION, least_bit, leftmost_child, MIN_CHUNK_SIZE, ok_address, ok_next, replace_dv, RTCHECK, set_inuse_and_pinuse, set_size_and_pinuse_of_free_chunk, set_size_and_pinuse_of_inuse_chunk, treebin_at, malloc_state::treemap, and unlink_large_chunk. Referenced by dlmalloc(). |
|
Definition at line 3094 of file malloc.c. References check_inuse_chunk, chunk2mem, chunk_plus_offset, chunksize, malloc_chunk::head, internal_free, internal_malloc, is_mmapped, MALLOC_FAILURE_ACTION, MAX_REQUEST, mem2chunk, memcpy(), MIN_CHUNK_SIZE, mmap_resize(), ok_address, ok_cinuse, ok_next, ok_pinuse, overhead_for, PINUSE_BIT, POSTACTION, PREACTION, request2size, RTCHECK, set_inuse, malloc_state::top, malloc_state::topsize, and USAGE_ERROR_ACTION. Referenced by dlrealloc(). Here is the call graph for this function: |
|
Definition at line 3165 of file malloc.c. References assert, check_inuse_chunk, chunk2mem, CHUNK_OVERHEAD, chunk_plus_offset, chunksize, CINUSE_BIT, malloc_chunk::head, internal_free, internal_malloc, is_mmapped, MALLOC_ALIGNMENT, MALLOC_FAILURE_ACTION, MAX_REQUEST, mem2chunk, MIN_CHUNK_SIZE, POSTACTION, PREACTION, malloc_chunk::prev_foot, request2size, and set_inuse. Referenced by dlmemalign(). |
|
Definition at line 3252 of file malloc.c. References assert, chunk2mem, CHUNK_OVERHEAD, chunk_plus_offset, chunksize, disable_mmap, enable_mmap, internal_malloc, is_mmapped, mem2chunk, memset(), PREACTION, request2size, set_size_and_pinuse_of_inuse_chunk, SIZE_T_SIZE, and use_mmap. Referenced by dlindependent_calloc(), and dlindependent_comalloc(). Here is the call graph for this function: |
|
Definition at line 3383 of file malloc.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, sys_alloc(), tmalloc_large(), tmalloc_small(), and unlink_first_small_chunk. Here is the call graph for this function: |
|
Definition at line 3515 of file malloc.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, sys_trim(), unlink_chunk, and USAGE_ERROR_ACTION. Here is the call graph for this function: |
|
Definition at line 3615 of file malloc.c. References calloc_must_clear, dlmalloc, MAX_SIZE_T, mem2chunk, and memset(). Here is the call graph for this function: |
|
Definition at line 3630 of file malloc.c. References dlfree, dlmalloc, gm, internal_realloc(), mem2chunk, ok_magic, and USAGE_ERROR_ACTION. Here is the call graph for this function: |
|
Definition at line 3653 of file malloc.c. References gm, and internal_memalign(). Here is the call graph for this function: |
|
Definition at line 3657 of file malloc.c. Here is the call graph for this function: |
|
Definition at line 3663 of file malloc.c. Here is the call graph for this function: |
|
Definition at line 3668 of file malloc.c. References dlmemalign, init_mparams(), mparams, and malloc_params::page_size. Here is the call graph for this function: |
|
Definition at line 3675 of file malloc.c. References dlmemalign, init_mparams(), mparams, and malloc_params::page_size. Here is the call graph for this function: |
|
Definition at line 3682 of file malloc.c. References gm, POSTACTION, PREACTION, and sys_trim(). Here is the call graph for this function: |
|
Definition at line 3691 of file malloc.c. References gm. |
|
Definition at line 3695 of file malloc.c. References gm. |
|
Definition at line 3700 of file malloc.c. References gm, and internal_mallinfo(). Here is the call graph for this function: |
|
Definition at line 3705 of file malloc.c. References gm, and internal_malloc_stats(). Here is the call graph for this function: |
|
Definition at line 3709 of file malloc.c. References chunksize, cinuse, mem2chunk, and overhead_for. |
|
Definition at line 3718 of file malloc.c. References change_mparam(). Here is the call graph for this function: |
|
|
|
|
|
Definition at line 1377 of file malloc.c. Referenced by change_mparam(), dlpvalloc(), dlvalloc(), init_mparams(), init_top(), mmap_resize(), sys_alloc(), and sys_trim(). |
|
|