#include "dlmalloc.h"
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
Data Structures | |
struct | malloc_chunk |
struct | malloc_params |
struct | malloc_segment |
struct | malloc_state |
struct | malloc_tree_chunk |
Macros | |
#define | ACQUIRE_MAGIC_INIT_LOCK() |
#define | ACQUIRE_MORECORE_LOCK() |
#define | align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) |
#define | align_offset(A) |
#define | assert(x) |
#define | bit_for_tree_index(i) (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) |
#define | CALL_MMAP(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) |
#define | CALL_MORECORE(S) MFAIL |
#define | CALL_MREMAP(addr, osz, nsz, mv) MFAIL |
#define | CALL_MUNMAP(a, s) munmap((a), (s)) |
#define | calloc_must_clear(p) (!is_mmapped(p)) |
#define | check_free_chunk(M, P) |
#define | check_inuse_chunk(M, P) |
#define | check_malloc_state(M) |
#define | check_malloced_chunk(M, P, N) |
#define | check_mmapped_chunk(M, P) |
#define | check_top_chunk(M, P) |
#define | chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) |
#define | CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) |
#define | chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) |
#define | CHUNK_OVERHEAD (SIZE_T_SIZE) |
#define | chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) |
#define | chunksize(p) ((p)->head & ~(INUSE_BITS)) |
#define | cinuse(p) ((p)->head & CINUSE_BIT) |
#define | CINUSE_BIT (SIZE_T_TWO) |
#define | clear_cinuse(p) ((p)->head &= ~CINUSE_BIT) |
#define | clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) |
#define | clear_smallmap(M, i) ((M)->smallmap &= ~idx2bit(i)) |
#define | clear_treemap(M, i) ((M)->treemap &= ~idx2bit(i)) |
#define | CMFAIL ((char*)(MFAIL)) /* defined for convenience */ |
#define | compute_bit2idx(X, I) |
#define | compute_tree_index(S, I) |
#define | CORRUPTION_ERROR_ACTION(m) ABORT |
#define | DIRECT_MMAP(s) CALL_MMAP(s) |
#define | disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) |
#define | disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) |
#define | disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) |
#define | enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) |
#define | enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) |
#define | EXTERN_BIT (8U) |
#define | FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) |
#define | FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) |
#define | get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) |
#define | gm (&_gm_) |
#define | granularity_align(S) (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) |
#define | HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) |
#define | idx2bit(i) ((binmap_t)(1) << (i)) |
#define | INITIAL_LOCK(l) |
#define | insert_chunk(M, P, S) |
#define | insert_large_chunk(M, X, S) |
#define | insert_small_chunk(M, P, S) |
#define | internal_free(m, mem) mspace_free(m,mem); |
#define | internal_malloc(m, b) mspace_malloc(m, b) |
#define | INUSE_BITS (PINUSE_BIT|CINUSE_BIT) |
#define | is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) |
#define | is_extern_segment(S) ((S)->sflags & EXTERN_BIT) |
#define | is_global(M) ((M) == &_gm_) |
#define | is_granularity_aligned(S) (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) |
#define | is_initialized(M) ((M)->top != 0) |
#define | is_mmapped(p) (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) |
#define | IS_MMAPPED_BIT (SIZE_T_ONE) |
#define | is_mmapped_segment(S) ((S)->sflags & IS_MMAPPED_BIT) |
#define | is_page_aligned(S) (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) |
#define | is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) |
#define | least_bit(x) ((x) & -(x)) |
#define | left_bits(x) ((x<<1) | -(x<<1)) |
#define | leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) |
#define | leftshift_for_tree_index(i) |
#define | mark_inuse_foot(M, p, s) |
#define | mark_smallmap(M, i) ((M)->smallmap |= idx2bit(i)) |
#define | mark_treemap(M, i) ((M)->treemap |= idx2bit(i)) |
#define | MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) |
#define | MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) |
#define | MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) |
#define | MCHUNK_SIZE (sizeof(mchunk)) |
#define | mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) |
#define | MFAIL ((void*)(MAX_SIZE_T)) |
#define | MIN_CHUNK_SIZE ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
#define | MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) |
#define | MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) |
#define | MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) |
#define | minsize_for_tree_index(i) |
#define | MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) |
#define | MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) |
#define | MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) |
#define | MMAP_PROT (PROT_READ|PROT_WRITE) |
#define | next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) |
#define | next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) |
#define | NSMALLBINS (32U) |
#define | NTREEBINS (32U) |
#define | ok_address(M, a) ((char*)(a) >= (M)->least_addr) |
#define | ok_cinuse(p) cinuse(p) |
#define | ok_magic(M) (1) |
#define | ok_next(p, n) ((char*)(p) < (char*)(n)) |
#define | ok_pinuse(p) pinuse(p) |
#define | overhead_for(p) (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) |
#define | pad_request(req) (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
#define | page_align(S) (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) |
#define | pinuse(p) ((p)->head & PINUSE_BIT) |
#define | PINUSE_BIT (SIZE_T_ONE) |
#define | POSTACTION(M) |
#define | PREACTION(M) (0) |
#define | prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) |
#define | RELEASE_MAGIC_INIT_LOCK() |
#define | RELEASE_MORECORE_LOCK() |
#define | replace_dv(M, P, S) |
#define | request2size(req) (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) |
#define | RTCHECK(e) __builtin_expect(e, 1) |
#define | same_or_left_bits(x) ((x) | -(x)) |
#define | segment_holds(S, A) ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) |
#define | set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) |
#define | set_free_with_pinuse(p, s, n) (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) |
#define | set_inuse(M, p, s) |
#define | set_inuse_and_pinuse(M, p, s) |
#define | set_lock(M, L) |
#define | set_size_and_pinuse_of_free_chunk(p, s) ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) |
#define | set_size_and_pinuse_of_inuse_chunk(M, p, s) ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) |
#define | should_trim(M, s) ((s) > (M)->trim_check) |
#define | SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) |
#define | SIZE_T_BITSIZE (sizeof(size_t) << 3) |
#define | SIZE_T_ONE ((size_t)1) |
#define | SIZE_T_SIZE (sizeof(size_t)) |
#define | SIZE_T_TWO ((size_t)2) |
#define | SIZE_T_ZERO ((size_t)0) |
#define | small_index(s) ((s) >> SMALLBIN_SHIFT) |
#define | small_index2size(i) ((i) << SMALLBIN_SHIFT) |
#define | smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) |
#define | SMALLBIN_SHIFT (3U) |
#define | SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) |
#define | smallmap_is_marked(M, i) ((M)->smallmap & idx2bit(i)) |
#define | TOP_FOOT_SIZE (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) |
#define | treebin_at(M, i) (&((M)->treebins[i])) |
#define | TREEBIN_SHIFT (8U) |
#define | treemap_is_marked(M, i) ((M)->treemap & idx2bit(i)) |
#define | TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) |
#define | unlink_chunk(M, P, S) |
#define | unlink_first_small_chunk(M, B, P, I) |
#define | unlink_large_chunk(M, X) |
#define | unlink_small_chunk(M, P, S) |
#define | USAGE_ERROR_ACTION(m, p) ABORT |
#define | use_lock(M) ((M)->mflags & USE_LOCK_BIT) |
#define | USE_LOCK_BIT (0U) |
#define | use_mmap(M) ((M)->mflags & USE_MMAP_BIT) |
#define | USE_MMAP_BIT (SIZE_T_ONE) |
#define | use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) |
#define | USE_NONCONTIGUOUS_BIT (4U) |
Typedefs | |
typedef unsigned int | bindex_t |
typedef unsigned int | binmap_t |
typedef unsigned int | flag_t |
typedef struct malloc_chunk | mchunk |
typedef struct malloc_chunk * | mchunkptr |
typedef struct malloc_segment | msegment |
typedef struct malloc_segment * | msegmentptr |
typedef struct malloc_state * | mstate |
typedef struct malloc_chunk * | sbinptr |
typedef struct malloc_tree_chunk * | tbinptr |
typedef struct malloc_tree_chunk | tchunk |
typedef struct malloc_tree_chunk * | tchunkptr |
Functions | |
static void | add_segment (mstate m, char *tbase, size_t tsize, flag_t mmapped) |
static int | change_mparam (int param_number, int value) |
mspace | create_mspace (size_t capacity, int locked) |
mspace | create_mspace_with_base (void *base, size_t capacity, int locked) |
size_t | destroy_mspace (mspace msp) |
static int | has_segment_link (mstate m, msegmentptr ss) |
static void ** | ialloc (mstate m, size_t n_elements, size_t *sizes, int opts, void *chunks[]) |
static void | init_bins (mstate m) |
static int | init_mparams (void) |
static void | init_top (mstate m, mchunkptr p, size_t psize) |
static mstate | init_user_mstate (char *tbase, size_t tsize) |
static struct mallinfo | internal_mallinfo (mstate m) |
static void | internal_malloc_stats (mstate m) |
static void * | internal_memalign (mstate m, size_t alignment, size_t bytes) |
static void * | internal_realloc (mstate m, void *oldmem, size_t bytes) |
static void * | mmap_alloc (mstate m, size_t nb) |
static mchunkptr | mmap_resize (mstate m, mchunkptr oldp, size_t nb) |
void * | mspace_calloc (mspace msp, size_t n_elements, size_t elem_size) |
size_t | mspace_footprint (mspace msp) |
void | mspace_free (mspace msp, void *mem) |
void ** | mspace_independent_calloc (mspace msp, size_t n_elements, size_t elem_size, void *chunks[]) |
void ** | mspace_independent_comalloc (mspace msp, size_t n_elements, size_t sizes[], void *chunks[]) |
struct mallinfo | mspace_mallinfo (mspace msp) |
void * | mspace_malloc (mspace msp, size_t bytes) |
void | mspace_malloc_stats (mspace msp) |
int | mspace_mallopt (int param_number, int value) |
size_t | mspace_max_footprint (mspace msp) |
void * | mspace_memalign (mspace msp, size_t alignment, size_t bytes) |
void * | mspace_realloc (mspace msp, void *oldmem, size_t bytes) |
int | mspace_trim (mspace msp, size_t pad) |
static void * | prepend_alloc (mstate m, char *newbase, char *oldbase, size_t nb) |
static size_t | release_unused_segments (mstate m) |
static msegmentptr | segment_holding (mstate m, char *addr) |
static void * | sys_alloc (mstate m, size_t nb) |
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) |
Variables | |
static struct malloc_state | _gm_ |
static struct malloc_params | mparams |
#define ACQUIRE_MAGIC_INIT_LOCK | ( | ) |
Referenced by init_mparams().
#define ACQUIRE_MORECORE_LOCK | ( | ) |
Referenced by sys_alloc(), and sys_trim().
#define align_as_chunk | ( | A | ) | (mchunkptr)((A) + align_offset(chunk2mem(A))) |
Referenced by init_user_mstate(), internal_mallinfo(), internal_malloc_stats(), prepend_alloc(), and release_unused_segments().
#define align_offset | ( | A | ) |
Referenced by add_segment(), init_top(), and mmap_alloc().
#define assert | ( | x | ) |
Referenced by add_segment(), ialloc(), internal_memalign(), mmap_alloc(), mspace_malloc(), prepend_alloc(), release_unused_segments(), tmalloc_large(), and tmalloc_small().
#define bit_for_tree_index | ( | i | ) | (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) |
#define CALL_MMAP | ( | s | ) | mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) |
Referenced by create_mspace(), and sys_alloc().
#define CALL_MORECORE | ( | S | ) | MFAIL |
Referenced by sys_alloc(), and sys_trim().
#define CALL_MREMAP | ( | addr, | |
osz, | |||
nsz, | |||
mv | |||
) | MFAIL |
Referenced by mmap_resize(), and sys_trim().
#define CALL_MUNMAP | ( | a, | |
s | |||
) | munmap((a), (s)) |
Referenced by destroy_mspace(), mspace_free(), release_unused_segments(), and sys_trim().
#define calloc_must_clear | ( | p | ) | (!is_mmapped(p)) |
Referenced by mspace_calloc().
#define check_free_chunk | ( | M, | |
P | |||
) |
Referenced by mspace_free(), and prepend_alloc().
#define check_inuse_chunk | ( | M, | |
P | |||
) |
Referenced by ialloc(), internal_memalign(), internal_realloc(), and mspace_free().
#define check_malloc_state | ( | M | ) |
Referenced by internal_mallinfo(), and internal_malloc_stats().
#define check_malloced_chunk | ( | M, | |
P, | |||
N | |||
) |
Referenced by mspace_malloc(), prepend_alloc(), and sys_alloc().
#define check_mmapped_chunk | ( | M, | |
P | |||
) |
Referenced by mmap_alloc(), and mmap_resize().
#define check_top_chunk | ( | M, | |
P | |||
) |
Referenced by add_segment(), init_user_mstate(), mspace_malloc(), prepend_alloc(), sys_alloc(), and sys_trim().
#define chunk2mem | ( | p | ) | ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) |
#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) |
Referenced by add_segment(), mmap_alloc(), and mmap_resize().
#define chunk_minus_offset | ( | p, | |
s | |||
) | ((mchunkptr)(((char*)(p)) - (s))) |
Referenced by mspace_free().
#define CHUNK_OVERHEAD (SIZE_T_SIZE) |
Referenced by ialloc(), and internal_memalign().
#define chunk_plus_offset | ( | p, | |
s | |||
) | ((mchunkptr)(((char*)(p)) + (s))) |
#define chunksize | ( | p | ) | ((p)->head & ~(INUSE_BITS)) |
#define cinuse | ( | p | ) | ((p)->head & CINUSE_BIT) |
Referenced by internal_mallinfo(), internal_malloc_stats(), mspace_free(), prepend_alloc(), and release_unused_segments().
#define CINUSE_BIT (SIZE_T_TWO) |
Referenced by init_user_mstate(), internal_memalign(), mmap_alloc(), and mmap_resize().
#define clear_cinuse | ( | p | ) | ((p)->head &= ~CINUSE_BIT) |
#define clear_pinuse | ( | p | ) | ((p)->head &= ~PINUSE_BIT) |
#define clear_smallmap | ( | M, | |
i | |||
) | ((M)->smallmap &= ~idx2bit(i)) |
#define clear_treemap | ( | M, | |
i | |||
) | ((M)->treemap &= ~idx2bit(i)) |
#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ |
Referenced by create_mspace(), mmap_alloc(), mmap_resize(), sys_alloc(), and sys_trim().
#define compute_bit2idx | ( | X, | |
I | |||
) |
Referenced by mspace_malloc(), tmalloc_large(), and tmalloc_small().
#define compute_tree_index | ( | S, | |
I | |||
) |
Referenced by tmalloc_large().
#define CORRUPTION_ERROR_ACTION | ( | m | ) | ABORT |
Referenced by tmalloc_large(), and tmalloc_small().
#define DIRECT_MMAP | ( | s | ) | CALL_MMAP(s) |
Referenced by mmap_alloc().
#define disable_contiguous | ( | M | ) | ((M)->mflags |= USE_NONCONTIGUOUS_BIT) |
Referenced by init_user_mstate(), and sys_alloc().
#define disable_lock | ( | M | ) | ((M)->mflags &= ~USE_LOCK_BIT) |
#define disable_mmap | ( | M | ) | ((M)->mflags &= ~USE_MMAP_BIT) |
Referenced by ialloc().
#define enable_lock | ( | M | ) | ((M)->mflags |= USE_LOCK_BIT) |
#define enable_mmap | ( | M | ) | ((M)->mflags |= USE_MMAP_BIT) |
Referenced by ialloc().
#define EXTERN_BIT (8U) |
Referenced by create_mspace_with_base(), and destroy_mspace().
#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) |
Referenced by add_segment(), internal_mallinfo(), internal_malloc_stats(), mmap_alloc(), and mmap_resize().
#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) |
Referenced by add_segment().
#define get_foot | ( | p, | |
s | |||
) | (((mchunkptr)((char*)(p) + (s)))->prev_foot) |
#define gm (&_gm_) |
Referenced by init_mparams().
#define granularity_align | ( | S | ) | (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) |
Referenced by create_mspace(), mmap_alloc(), mmap_resize(), and sys_alloc().
#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) |
Referenced by sys_alloc(), and sys_trim().
#define idx2bit | ( | i | ) | ((binmap_t)(1) << (i)) |
Referenced by mspace_malloc(), and tmalloc_large().
#define INITIAL_LOCK | ( | l | ) |
Referenced by init_mparams(), and init_user_mstate().
#define insert_chunk | ( | M, | |
P, | |||
S | |||
) |
Referenced by add_segment(), mspace_free(), prepend_alloc(), and tmalloc_large().
#define insert_large_chunk | ( | M, | |
X, | |||
S | |||
) |
Referenced by release_unused_segments().
#define insert_small_chunk | ( | M, | |
P, | |||
S | |||
) |
#define internal_free | ( | m, | |
mem | |||
) | mspace_free(m,mem); |
Referenced by internal_memalign(), and internal_realloc().
#define internal_malloc | ( | m, | |
b | |||
) | mspace_malloc(m, b) |
Referenced by ialloc(), internal_memalign(), internal_realloc(), and mspace_calloc().
#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) |
Referenced by mspace_free().
#define is_aligned | ( | A | ) | (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) |
Referenced by add_segment(), and mmap_alloc().
#define is_extern_segment | ( | S | ) | ((S)->sflags & EXTERN_BIT) |
Referenced by release_unused_segments(), sys_alloc(), and sys_trim().
#define is_global | ( | M | ) | ((M) == &_gm_) |
Referenced by sys_alloc().
#define is_granularity_aligned | ( | S | ) | (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) |
#define is_initialized | ( | M | ) | ((M)->top != 0) |
Referenced by internal_mallinfo(), internal_malloc_stats(), sys_alloc(), and sys_trim().
#define is_mmapped | ( | p | ) | (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) |
Referenced by ialloc(), internal_memalign(), and internal_realloc().
#define IS_MMAPPED_BIT (SIZE_T_ONE) |
Referenced by create_mspace(), mmap_alloc(), mmap_resize(), and sys_alloc().
#define is_mmapped_segment | ( | S | ) | ((S)->sflags & IS_MMAPPED_BIT) |
Referenced by release_unused_segments(), and sys_trim().
#define is_page_aligned | ( | S | ) | (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) |
Referenced by sys_alloc().
#define is_small | ( | s | ) | (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) |
Referenced by mmap_resize().
#define least_bit | ( | x | ) | ((x) & -(x)) |
Referenced by mspace_malloc(), tmalloc_large(), and tmalloc_small().
#define left_bits | ( | x | ) | ((x<<1) | -(x<<1)) |
Referenced by mspace_malloc(), and tmalloc_large().
#define leftmost_child | ( | t | ) | ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) |
Referenced by tmalloc_large(), and tmalloc_small().
#define leftshift_for_tree_index | ( | i | ) |
Referenced by tmalloc_large().
#define mark_inuse_foot | ( | M, | |
p, | |||
s | |||
) |
Referenced by mmap_alloc(), and mmap_resize().
#define mark_smallmap | ( | M, | |
i | |||
) | ((M)->smallmap |= idx2bit(i)) |
#define mark_treemap | ( | M, | |
i | |||
) | ((M)->treemap |= idx2bit(i)) |
#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) |
Referenced by internal_memalign(), internal_realloc(), mspace_malloc(), and sys_trim().
#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) |
Referenced by mspace_malloc().
#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) |
#define MCHUNK_SIZE (sizeof(mchunk)) |
Referenced by init_mparams().
#define mem2chunk | ( | mem | ) | ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) |
Referenced by ialloc(), init_user_mstate(), internal_memalign(), internal_realloc(), mspace_calloc(), mspace_free(), mspace_realloc(), and sys_alloc().
#define MFAIL ((void*)(MAX_SIZE_T)) |
Referenced by sys_trim().
#define MIN_CHUNK_SIZE ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
Referenced by add_segment(), init_mparams(), internal_memalign(), internal_realloc(), mspace_malloc(), prepend_alloc(), tmalloc_large(), and tmalloc_small().
#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) |
#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) |
Referenced by mspace_malloc().
#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) |
#define minsize_for_tree_index | ( | i | ) |
#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) |
#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) |
#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) |
Referenced by mmap_alloc(), mmap_resize(), and mspace_free().
#define MMAP_PROT (PROT_READ|PROT_WRITE) |
#define next_chunk | ( | p | ) | ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) |
Referenced by init_user_mstate(), internal_mallinfo(), internal_malloc_stats(), and sys_alloc().
#define next_pinuse | ( | p | ) | ((next_chunk(p)->head) & PINUSE_BIT) |
#define NSMALLBINS (32U) |
Referenced by init_bins().
#define NTREEBINS (32U) |
#define ok_address | ( | M, | |
a | |||
) | ((char*)(a) >= (M)->least_addr) |
Referenced by internal_realloc(), mspace_free(), tmalloc_large(), and tmalloc_small().
#define ok_cinuse | ( | p | ) | cinuse(p) |
Referenced by internal_realloc(), and mspace_free().
#define ok_magic | ( | M | ) | (1) |
#define ok_next | ( | p, | |
n | |||
) | ((char*)(p) < (char*)(n)) |
Referenced by internal_realloc(), mspace_free(), tmalloc_large(), and tmalloc_small().
#define ok_pinuse | ( | p | ) | pinuse(p) |
Referenced by internal_realloc(), and mspace_free().
#define overhead_for | ( | p | ) | (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) |
Referenced by internal_realloc().
#define pad_request | ( | req | ) | (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
Referenced by add_segment(), create_mspace(), create_mspace_with_base(), init_user_mstate(), and mspace_malloc().
#define page_align | ( | S | ) | (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) |
Referenced by sys_alloc().
#define pinuse | ( | p | ) | ((p)->head & PINUSE_BIT) |
Referenced by mspace_free(), and prepend_alloc().
#define PINUSE_BIT (SIZE_T_ONE) |
Referenced by init_top(), init_user_mstate(), internal_realloc(), mspace_free(), mspace_malloc(), prepend_alloc(), and sys_alloc().
#define POSTACTION | ( | M | ) |
Referenced by ialloc(), internal_mallinfo(), internal_malloc_stats(), internal_memalign(), internal_realloc(), mspace_free(), mspace_malloc(), and mspace_trim().
#define PREACTION | ( | M | ) | (0) |
Referenced by ialloc(), internal_mallinfo(), internal_malloc_stats(), internal_memalign(), internal_realloc(), mspace_free(), mspace_malloc(), and mspace_trim().
#define prev_chunk | ( | p | ) | ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) |
#define RELEASE_MAGIC_INIT_LOCK | ( | ) |
Referenced by init_mparams().
#define RELEASE_MORECORE_LOCK | ( | ) |
Referenced by sys_alloc(), and sys_trim().
#define replace_dv | ( | M, | |
P, | |||
S | |||
) |
Referenced by mspace_malloc(), and tmalloc_small().
#define request2size | ( | req | ) | (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) |
Referenced by ialloc(), internal_memalign(), and internal_realloc().
#define RTCHECK | ( | e | ) | __builtin_expect(e, 1) |
Referenced by internal_realloc(), mspace_free(), tmalloc_large(), and tmalloc_small().
#define same_or_left_bits | ( | x | ) | ((x) | -(x)) |
#define segment_holds | ( | S, | |
A | |||
) | ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) |
Referenced by internal_mallinfo(), internal_malloc_stats(), release_unused_segments(), and sys_alloc().
#define set_foot | ( | p, | |
s | |||
) | (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) |
#define set_free_with_pinuse | ( | p, | |
s, | |||
n | |||
) | (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) |
Referenced by add_segment(), mspace_free(), and prepend_alloc().
#define set_inuse | ( | M, | |
p, | |||
s | |||
) |
Referenced by internal_memalign(), and internal_realloc().
#define set_inuse_and_pinuse | ( | M, | |
p, | |||
s | |||
) |
Referenced by mspace_malloc(), tmalloc_large(), and tmalloc_small().
#define set_lock | ( | M, | |
L | |||
) |
Referenced by create_mspace(), and create_mspace_with_base().
#define set_size_and_pinuse_of_free_chunk | ( | p, | |
s | |||
) | ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) |
Referenced by mspace_free(), mspace_malloc(), prepend_alloc(), tmalloc_large(), and tmalloc_small().
#define set_size_and_pinuse_of_inuse_chunk | ( | M, | |
p, | |||
s | |||
) | ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) |
Referenced by add_segment(), ialloc(), mspace_malloc(), prepend_alloc(), sys_alloc(), tmalloc_large(), and tmalloc_small().
#define should_trim | ( | M, | |
s | |||
) | ((s) > (M)->trim_check) |
Referenced by mspace_free().
#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) |
Referenced by mmap_alloc(), and mmap_resize().
#define SIZE_T_BITSIZE (sizeof(size_t) << 3) |
Referenced by tmalloc_large().
#define SIZE_T_ONE ((size_t)1) |
Referenced by init_mparams(), internal_mallinfo(), internal_memalign(), sys_alloc(), sys_trim(), and tmalloc_large().
#define SIZE_T_SIZE (sizeof(size_t)) |
Referenced by add_segment(), ialloc(), mmap_alloc(), mmap_resize(), and mspace_malloc().
#define SIZE_T_TWO ((size_t)2) |
#define SIZE_T_ZERO ((size_t)0) |
#define small_index | ( | s | ) | ((s) >> SMALLBIN_SHIFT) |
Referenced by mspace_malloc().
#define small_index2size | ( | i | ) | ((i) << SMALLBIN_SHIFT) |
Referenced by mspace_malloc().
#define smallbin_at | ( | M, | |
i | |||
) | ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) |
Referenced by init_bins(), and mspace_malloc().
#define SMALLBIN_SHIFT (3U) |
#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) |
#define smallmap_is_marked | ( | M, | |
i | |||
) | ((M)->smallmap & idx2bit(i)) |
#define TOP_FOOT_SIZE (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) |
#define treebin_at | ( | M, | |
i | |||
) | (&((M)->treebins[i])) |
Referenced by tmalloc_large(), and tmalloc_small().
#define TREEBIN_SHIFT (8U) |
#define treemap_is_marked | ( | M, | |
i | |||
) | ((M)->treemap & idx2bit(i)) |
#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) |
#define unlink_chunk | ( | M, | |
P, | |||
S | |||
) |
Referenced by mspace_free(), and prepend_alloc().
#define unlink_first_small_chunk | ( | M, | |
B, | |||
P, | |||
I | |||
) |
Referenced by mspace_malloc().
#define unlink_large_chunk | ( | M, | |
X | |||
) |
Referenced by release_unused_segments(), tmalloc_large(), and tmalloc_small().
#define unlink_small_chunk | ( | M, | |
P, | |||
S | |||
) |
#define USAGE_ERROR_ACTION | ( | m, | |
p | |||
) | ABORT |
Referenced by destroy_mspace(), internal_realloc(), mspace_calloc(), mspace_footprint(), mspace_free(), mspace_independent_calloc(), mspace_independent_comalloc(), mspace_mallinfo(), mspace_malloc(), mspace_malloc_stats(), mspace_max_footprint(), mspace_memalign(), mspace_realloc(), and mspace_trim().
#define use_lock | ( | M | ) | ((M)->mflags & USE_LOCK_BIT) |
#define USE_LOCK_BIT (0U) |
Referenced by init_mparams().
#define use_mmap | ( | M | ) | ((M)->mflags & USE_MMAP_BIT) |
Referenced by ialloc(), and sys_alloc().
#define USE_MMAP_BIT (SIZE_T_ONE) |
Referenced by init_mparams().
#define use_noncontiguous | ( | M | ) | ((M)->mflags & USE_NONCONTIGUOUS_BIT) |
Referenced by sys_alloc().
#define USE_NONCONTIGUOUS_BIT (4U) |
Referenced by init_mparams().
typedef unsigned int bindex_t |
typedef unsigned int binmap_t |
typedef unsigned int flag_t |
typedef struct malloc_chunk mchunk |
typedef struct malloc_chunk* mchunkptr |
typedef struct malloc_segment msegment |
typedef struct malloc_segment* msegmentptr |
typedef struct malloc_state* mstate |
typedef struct malloc_chunk* sbinptr |
typedef struct malloc_tree_chunk* tbinptr |
typedef struct malloc_tree_chunk tchunk |
typedef struct malloc_tree_chunk* tchunkptr |
References align_offset, assert, malloc_segment::base, check_top_chunk, chunk2mem, CHUNK_ALIGN_MASK, chunk_plus_offset, FENCEPOST_HEAD, FOUR_SIZE_T_SIZES, malloc_chunk::head, init_top(), insert_chunk, is_aligned, MIN_CHUNK_SIZE, malloc_segment::next, pad_request, malloc_state::seg, segment_holding(), set_free_with_pinuse, set_size_and_pinuse_of_inuse_chunk, malloc_segment::sflags, malloc_segment::size, SIZE_T_SIZE, malloc_state::top, and TOP_FOOT_SIZE.
Referenced by sys_alloc().
|
static |
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 mspace_mallopt().
mspace create_mspace | ( | size_t | capacity, |
int | locked | ||
) |
mspace create_mspace_with_base | ( | void * | base, |
size_t | capacity, | ||
int | locked | ||
) |
References EXTERN_BIT, init_mparams(), init_user_mstate(), mparams, pad_request, malloc_params::page_size, malloc_state::seg, set_lock, malloc_segment::sflags, and TOP_FOOT_SIZE.
Referenced by load_sdram_data().
size_t destroy_mspace | ( | mspace | msp | ) |
|
static |
References malloc_segment::base, malloc_segment::next, malloc_state::seg, and malloc_segment::size.
Referenced by sys_trim().
|
static |
References assert, check_inuse_chunk, chunk2mem, CHUNK_OVERHEAD, chunk_plus_offset, chunksize, disable_mmap, enable_mmap, internal_malloc, is_mmapped, mem2chunk, POSTACTION, PREACTION, request2size, set_size_and_pinuse_of_inuse_chunk, SIZE_T_SIZE, and use_mmap.
Referenced by mspace_independent_calloc(), and mspace_independent_comalloc().
|
static |
References malloc_chunk::bk, malloc_chunk::fd, NSMALLBINS, and smallbin_at.
Referenced by init_user_mstate(), and sys_alloc().
|
static |
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, malloc_params::page_size, 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(), create_mspace(), create_mspace_with_base(), and sys_alloc().
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(), init_user_mstate(), sys_alloc(), and sys_trim().
|
static |
References align_as_chunk, malloc_segment::base, check_top_chunk, chunk2mem, CINUSE_BIT, malloc_params::default_mflags, disable_contiguous, malloc_state::footprint, malloc_chunk::head, init_bins(), init_top(), INITIAL_LOCK, malloc_state::least_addr, malloc_state::magic, malloc_params::magic, malloc_state::max_footprint, mem2chunk, malloc_state::mflags, mparams, next_chunk, pad_request, PINUSE_BIT, malloc_state::seg, malloc_segment::size, malloc_state::top, and TOP_FOOT_SIZE.
Referenced by create_mspace(), and create_mspace_with_base().
References align_as_chunk, mallinfo::arena, malloc_segment::base, check_malloc_state, chunksize, cinuse, FENCEPOST_HEAD, malloc_state::footprint, mallinfo::fordblks, mallinfo::hblkhd, malloc_chunk::head, is_initialized, mallinfo::keepcost, malloc_state::max_footprint, malloc_segment::next, next_chunk, mallinfo::ordblks, POSTACTION, PREACTION, malloc_state::seg, segment_holds, SIZE_T_ONE, malloc_state::top, TOP_FOOT_SIZE, malloc_state::topsize, mallinfo::uordblks, and mallinfo::usmblks.
Referenced by mspace_mallinfo().
|
static |
References align_as_chunk, malloc_segment::base, check_malloc_state, chunksize, cinuse, FENCEPOST_HEAD, malloc_state::footprint, 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 mspace_malloc_stats().
|
static |
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, set_inuse, and SIZE_T_ONE.
Referenced by mspace_memalign().
|
static |
References check_inuse_chunk, chunk2mem, chunk_plus_offset, chunksize, malloc_chunk::head, internal_free, internal_malloc, is_mmapped, MALLOC_FAILURE_ACTION, MAX_REQUEST, mem2chunk, 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 mspace_realloc().
|
static |
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().
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().
void* mspace_calloc | ( | mspace | msp, |
size_t | n_elements, | ||
size_t | elem_size | ||
) |
References calloc_must_clear, internal_malloc, MAX_SIZE_T, mem2chunk, ok_magic, and USAGE_ERROR_ACTION.
size_t mspace_footprint | ( | mspace | msp | ) |
References malloc_state::footprint, ok_magic, and USAGE_ERROR_ACTION.
void mspace_free | ( | mspace | msp, |
void * | mem | ||
) |
References CALL_MUNMAP, check_free_chunk, check_inuse_chunk, chunk_minus_offset, chunk_plus_offset, chunksize, cinuse, malloc_state::dv, malloc_state::dvsize, malloc_state::footprint, malloc_chunk::head, insert_chunk, INUSE_BITS, 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(), malloc_state::top, malloc_state::topsize, unlink_chunk, and USAGE_ERROR_ACTION.
Referenced by mspace_realloc().
void** mspace_independent_calloc | ( | mspace | msp, |
size_t | n_elements, | ||
size_t | elem_size, | ||
void * | chunks[] | ||
) |
References ialloc(), ok_magic, and USAGE_ERROR_ACTION.
void** mspace_independent_comalloc | ( | mspace | msp, |
size_t | n_elements, | ||
size_t | sizes[], | ||
void * | chunks[] | ||
) |
References ialloc(), ok_magic, and USAGE_ERROR_ACTION.
References internal_mallinfo(), ok_magic, and USAGE_ERROR_ACTION.
void* mspace_malloc | ( | mspace | msp, |
size_t | bytes | ||
) |
References assert, check_malloced_chunk, check_top_chunk, chunk2mem, chunk_plus_offset, chunksize, compute_bit2idx, malloc_state::dv, malloc_state::dvsize, malloc_chunk::fd, malloc_chunk::head, idx2bit, least_bit, left_bits, MAX_REQUEST, MAX_SIZE_T, MAX_SMALL_REQUEST, MIN_CHUNK_SIZE, MIN_REQUEST, ok_magic, 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, malloc_state::smallmap, sys_alloc(), tmalloc_large(), tmalloc_small(), malloc_state::top, malloc_state::topsize, malloc_state::treemap, unlink_first_small_chunk, and USAGE_ERROR_ACTION.
Referenced by load_sdram_data(), and mspace_realloc().
void mspace_malloc_stats | ( | mspace | msp | ) |
References internal_malloc_stats(), ok_magic, and USAGE_ERROR_ACTION.
int mspace_mallopt | ( | int | param_number, |
int | value | ||
) |
References change_mparam().
size_t mspace_max_footprint | ( | mspace | msp | ) |
References malloc_state::max_footprint, ok_magic, and USAGE_ERROR_ACTION.
void* mspace_memalign | ( | mspace | msp, |
size_t | alignment, | ||
size_t | bytes | ||
) |
References internal_memalign(), ok_magic, and USAGE_ERROR_ACTION.
void* mspace_realloc | ( | mspace | msp, |
void * | oldmem, | ||
size_t | bytes | ||
) |
References internal_realloc(), mem2chunk, mspace_free(), mspace_malloc(), ok_magic, and USAGE_ERROR_ACTION.
int mspace_trim | ( | mspace | msp, |
size_t | pad | ||
) |
References ok_magic, POSTACTION, PREACTION, sys_trim(), and USAGE_ERROR_ACTION.
|
static |
References align_as_chunk, assert, check_free_chunk, check_malloced_chunk, check_top_chunk, chunk2mem, chunk_plus_offset, chunksize, cinuse, malloc_state::dv, malloc_state::dvsize, malloc_chunk::head, insert_chunk, MIN_CHUNK_SIZE, pinuse, PINUSE_BIT, set_free_with_pinuse, set_size_and_pinuse_of_free_chunk, set_size_and_pinuse_of_inuse_chunk, malloc_state::top, malloc_state::topsize, and unlink_chunk.
Referenced by sys_alloc().
|
static |
References align_as_chunk, assert, malloc_segment::base, 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, malloc_segment::size, TOP_FOOT_SIZE, and unlink_large_chunk.
Referenced by sys_trim().
|
static |
References malloc_segment::base, malloc_segment::next, malloc_state::seg, and malloc_segment::size.
Referenced by add_segment(), sys_alloc(), and sys_trim().
|
static |
References ACQUIRE_MORECORE_LOCK, add_segment(), malloc_segment::base, CALL_MMAP, CALL_MORECORE, check_malloced_chunk, check_top_chunk, chunk2mem, chunk_plus_offset, CMFAIL, disable_contiguous, malloc_state::footprint, granularity_align, HALF_MAX_SIZE_T, HAVE_MMAP, HAVE_MORECORE, malloc_chunk::head, init_bins(), init_mparams(), init_top(), is_extern_segment, is_global, is_initialized, IS_MMAPPED_BIT, is_page_aligned, malloc_state::least_addr, malloc_state::magic, malloc_params::magic, MALLOC_FAILURE_ACTION, malloc_state::max_footprint, mem2chunk, mmap_alloc(), malloc_params::mmap_threshold, MORECORE_CONTIGUOUS, mparams, malloc_segment::next, next_chunk, page_align, PINUSE_BIT, prepend_alloc(), RELEASE_MORECORE_LOCK, malloc_state::seg, segment_holding(), segment_holds, set_size_and_pinuse_of_inuse_chunk, malloc_segment::sflags, malloc_segment::size, SIZE_T_ONE, malloc_state::top, TOP_FOOT_SIZE, malloc_state::topsize, use_mmap, and use_noncontiguous.
Referenced by mspace_malloc().
|
static |
References ACQUIRE_MORECORE_LOCK, malloc_segment::base, 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(), malloc_segment::size, SIZE_T_ONE, malloc_state::top, TOP_FOOT_SIZE, malloc_state::topsize, and malloc_state::trim_check.
Referenced by mspace_free(), and mspace_trim().
|
static |
References assert, malloc_tree_chunk::child, chunk2mem, chunk_plus_offset, chunksize, compute_bit2idx, compute_tree_index, CORRUPTION_ERROR_ACTION, malloc_state::dvsize, idx2bit, insert_chunk, least_bit, left_bits, leftmost_child, leftshift_for_tree_index, MIN_CHUNK_SIZE, ok_address, ok_next, RTCHECK, set_inuse_and_pinuse, set_size_and_pinuse_of_free_chunk, set_size_and_pinuse_of_inuse_chunk, SIZE_T_BITSIZE, SIZE_T_ONE, treebin_at, malloc_state::treemap, and unlink_large_chunk.
Referenced by mspace_malloc().
|
static |
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 mspace_malloc().
|
static |
|
static |
Referenced by change_mparam(), create_mspace(), create_mspace_with_base(), init_mparams(), init_top(), init_user_mstate(), mmap_resize(), sys_alloc(), and sys_trim().