FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
dlmalloc.c File Reference
+ Include dependency graph for dlmalloc.c:

Go to the source code of this file.

Data Structures

struct  malloc_chunk
 
struct  malloc_tree_chunk
 
struct  malloc_segment
 
struct  malloc_state
 
struct  malloc_params
 

Macros

#define assert(x)
 
#define DEBUG   0
 
#define LOCK_AT_FORK   0
 
#define malloc_getpagesize   sysconf(_SC_PAGE_SIZE)
 
#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 SIZE_T_FOUR   ((size_t)4)
 
#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 CALL_MORECORE(S)   MFAIL
 Define CALL_MORECORE. More...
 
#define USE_MMAP_BIT   (SIZE_T_ZERO)
 Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP. More...
 
#define MMAP(s)   MFAIL
 
#define MUNMAP(a, s)   (-1)
 
#define DIRECT_MMAP(s)   MFAIL
 
#define CALL_DIRECT_MMAP(s)   DIRECT_MMAP(s)
 
#define CALL_MMAP(s)   MMAP(s)
 
#define CALL_MUNMAP(a, s)   MUNMAP((a), (s))
 
#define CALL_MREMAP(addr, osz, nsz, mv)   MFAIL
 Define CALL_MREMAP. More...
 
#define USE_NONCONTIGUOUS_BIT   (4U)
 
#define USE_NOEXPAND_BIT   (8U)
 
#define USE_TRACE_BIT   (16U)
 
#define EXTERN_BIT   (8U)
 
#define USE_LOCK_BIT   (0U)
 
#define INITIAL_LOCK(l)   (0)
 
#define DESTROY_LOCK(l)   (0)
 
#define ACQUIRE_MALLOC_GLOBAL_LOCK()
 
#define RELEASE_MALLOC_GLOBAL_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 FLAG4_BIT   (SIZE_T_FOUR)
 
#define INUSE_BITS   (PINUSE_BIT|CINUSE_BIT)
 
#define FLAG_BITS   (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT)
 
#define FENCEPOST_HEAD   (INUSE_BITS|SIZE_T_SIZE)
 
#define cinuse(p)   ((p)->head & CINUSE_BIT)
 
#define pinuse(p)   ((p)->head & PINUSE_BIT)
 
#define flag4inuse(p)   ((p)->head & FLAG4_BIT)
 
#define is_inuse(p)   (((p)->head & INUSE_BITS) != PINUSE_BIT)
 
#define is_mmapped(p)   (((p)->head & INUSE_BITS) == 0)
 
#define chunksize(p)   ((p)->head & ~(FLAG_BITS))
 
#define clear_pinuse(p)   ((p)->head &= ~PINUSE_BIT)
 
#define set_flag4(p)   ((p)->head |= FLAG4_BIT)
 
#define clear_flag4(p)   ((p)->head &= ~FLAG4_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 & ~FLAG_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 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 is_mmapped_segment(S)   ((S)->sflags & USE_MMAP_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 ensure_initialization()   (void)(mparams.magic != 0 || init_mparams())
 
#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)
 
#define use_mmap(M)   ((M)->mflags & USE_MMAP_BIT)
 
#define enable_mmap(M)   ((M)->mflags |= USE_MMAP_BIT)
 
#define disable_mmap(M)
 
#define use_noncontiguous(M)   ((M)->mflags & USE_NONCONTIGUOUS_BIT)
 
#define disable_contiguous(M)   ((M)->mflags |= USE_NONCONTIGUOUS_BIT)
 
#define use_noexpand(M)   ((M)->mflags & USE_NOEXPAND_BIT)
 
#define disable_expand(M)   ((M)->mflags |= USE_NOEXPAND_BIT)
 
#define use_trace(M)   ((M)->mflags & USE_TRACE_BIT)
 
#define enable_trace(M)   ((M)->mflags |= USE_TRACE_BIT)
 
#define disable_trace(M)   ((M)->mflags &= ~USE_TRACE_BIT)
 
#define set_lock(M, L)
 
#define page_align(S)   (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
 
#define granularity_align(S)
 
#define mmap_align(S)   page_align(S)
 
#define SYS_ALLOC_PADDING   (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)
 
#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)   DLM_ABORT
 
#define USAGE_ERROR_ACTION(m, p)   DLM_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)   (bindex_t)((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 least_bit(x)   ((x) & -(x))
 
#define left_bits(x)   ((x<<1) | -(x<<1))
 
#define same_or_left_bits(x)   ((x) | -(x))
 
#define compute_bit2idx(X, I)
 
#define ok_address(M, a)   ((char*)(a) >= (M)->least_addr)
 
#define ok_next(p, n)   ((char*)(p) < (char*)(n))
 
#define ok_inuse(p)   is_inuse(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)
 
#define fm   gm
 

Typedefs

typedef struct malloc_chunk mchunk
 
typedef struct malloc_chunkmchunkptr
 
typedef struct malloc_chunksbinptr
 
typedef unsigned int bindex_t
 
typedef unsigned int binmap_t
 
typedef unsigned int flag_t
 
typedef struct malloc_tree_chunk tchunk
 
typedef struct malloc_tree_chunktchunkptr
 
typedef struct malloc_tree_chunktbinptr
 
typedef struct malloc_segment msegment
 
typedef struct malloc_segmentmsegmentptr
 
typedef struct malloc_statemstate
 

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 dlmallinfo 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, int flags)
 
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 dispose_chunk (mstate m, mchunkptr p, size_t psize)
 
static void * tmalloc_large (mstate m, size_t nb)
 
static void * tmalloc_small (mstate m, size_t nb)
 
void * dlmalloc (size_t bytes)
 
void dlfree (void *mem)
 
void * dlcalloc (size_t n_elements, size_t elem_size)
 
static mchunkptr try_realloc_chunk (mstate m, mchunkptr p, size_t nb, int can_move)
 
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[])
 
static size_t internal_bulk_free (mstate m, void *array[], size_t nelem)
 
void * dlrealloc (void *oldmem, size_t bytes)
 
void * dlrealloc_in_place (void *oldmem, size_t bytes)
 
void * dlmemalign (size_t alignment, size_t bytes)
 
int dlposix_memalign (void **pp, size_t alignment, size_t bytes)
 
void * dlvalloc (size_t bytes)
 
void * dlpvalloc (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[])
 
size_t dlbulk_free (void *array[], size_t nelem)
 
int dlmalloc_trim (size_t pad)
 
size_t dlmalloc_footprint (void)
 
size_t dlmalloc_max_footprint (void)
 
size_t dlmalloc_footprint_limit (void)
 
size_t dlmalloc_set_footprint_limit (size_t bytes)
 
struct dlmallinfo dlmallinfo (void)
 
void dlmalloc_stats ()
 
int dlmallopt (int param_number, int value)
 
size_t dlmalloc_usable_size (void *mem)
 

Variables

static struct malloc_params mparams
 

Macro Definition Documentation

◆ ACQUIRE_MALLOC_GLOBAL_LOCK

#define ACQUIRE_MALLOC_GLOBAL_LOCK ( )

Definition at line 392 of file dlmalloc.c.

◆ align_as_chunk

#define align_as_chunk (   A)    (mchunkptr)((A) + align_offset(chunk2mem(A)))

Definition at line 805 of file dlmalloc.c.

◆ align_offset

#define align_offset (   A)
Value:
((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
#define CHUNK_ALIGN_MASK
Definition: dlmalloc.c:193
#define A(x)
Definition: main.c:1018
#define MALLOC_ALIGNMENT
Definition: dlmalloc.h:633

Definition at line 199 of file dlmalloc.c.

◆ assert

#define assert (   x)

Definition at line 30 of file dlmalloc.c.

◆ bit_for_tree_index

#define bit_for_tree_index (   i)    (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)

Definition at line 1487 of file dlmalloc.c.

◆ CALL_DIRECT_MMAP

#define CALL_DIRECT_MMAP (   s)    DIRECT_MMAP(s)

Definition at line 327 of file dlmalloc.c.

◆ CALL_MMAP

#define CALL_MMAP (   s)    MMAP(s)

Definition at line 328 of file dlmalloc.c.

◆ CALL_MORECORE

#define CALL_MORECORE (   S)    MFAIL

Define CALL_MORECORE.

Definition at line 297 of file dlmalloc.c.

◆ CALL_MREMAP

#define CALL_MREMAP (   addr,
  osz,
  nsz,
  mv 
)    MFAIL

Define CALL_MREMAP.

Definition at line 342 of file dlmalloc.c.

◆ CALL_MUNMAP

#define CALL_MUNMAP (   a,
 
)    MUNMAP((a), (s))

Definition at line 329 of file dlmalloc.c.

◆ calloc_must_clear

#define calloc_must_clear (   p)    (1)

Definition at line 883 of file dlmalloc.c.

◆ check_free_chunk

#define check_free_chunk (   M,
  P 
)

Definition at line 1382 of file dlmalloc.c.

◆ check_inuse_chunk

#define check_inuse_chunk (   M,
  P 
)

Definition at line 1383 of file dlmalloc.c.

◆ check_malloc_state

#define check_malloc_state (   M)

Definition at line 1386 of file dlmalloc.c.

◆ check_malloced_chunk

#define check_malloced_chunk (   M,
  P,
 
)

Definition at line 1384 of file dlmalloc.c.

◆ check_mmapped_chunk

#define check_mmapped_chunk (   M,
  P 
)

Definition at line 1385 of file dlmalloc.c.

◆ check_top_chunk

#define check_top_chunk (   M,
  P 
)

Definition at line 1387 of file dlmalloc.c.

◆ chunk2mem

#define chunk2mem (   p)    ((void*)((char*)(p) + TWO_SIZE_T_SIZES))

Definition at line 802 of file dlmalloc.c.

◆ CHUNK_ALIGN_MASK

#define CHUNK_ALIGN_MASK   (MALLOC_ALIGNMENT - SIZE_T_ONE)

Definition at line 193 of file dlmalloc.c.

◆ chunk_minus_offset

#define chunk_minus_offset (   p,
 
)    ((mchunkptr)(((char*)(p)) - (s)))

Definition at line 854 of file dlmalloc.c.

◆ CHUNK_OVERHEAD

#define CHUNK_OVERHEAD   (SIZE_T_SIZE)

Definition at line 789 of file dlmalloc.c.

◆ chunk_plus_offset

#define chunk_plus_offset (   p,
 
)    ((mchunkptr)(((char*)(p)) + (s)))

Definition at line 853 of file dlmalloc.c.

◆ chunksize

#define chunksize (   p)    ((p)->head & ~(FLAG_BITS))

Definition at line 846 of file dlmalloc.c.

◆ cinuse

#define cinuse (   p)    ((p)->head & CINUSE_BIT)

Definition at line 840 of file dlmalloc.c.

◆ CINUSE_BIT

#define CINUSE_BIT   (SIZE_T_TWO)

Definition at line 831 of file dlmalloc.c.

◆ clear_flag4

#define clear_flag4 (   p)    ((p)->head &= ~FLAG4_BIT)

Definition at line 850 of file dlmalloc.c.

◆ clear_pinuse

#define clear_pinuse (   p)    ((p)->head &= ~PINUSE_BIT)

Definition at line 848 of file dlmalloc.c.

◆ clear_smallmap

#define clear_smallmap (   M,
  i 
)    ((M)->smallmap &= ~idx2bit(i))

Definition at line 1508 of file dlmalloc.c.

◆ clear_treemap

#define clear_treemap (   M,
  i 
)    ((M)->treemap &= ~idx2bit(i))

Definition at line 1512 of file dlmalloc.c.

◆ CMFAIL

#define CMFAIL   ((char*)(MFAIL)) /* defined for convenience */

Definition at line 214 of file dlmalloc.c.

◆ compute_bit2idx

#define compute_bit2idx (   X,
 
)
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);\
}
unsigned int bindex_t
Definition: dlmalloc.c:778

Definition at line 1554 of file dlmalloc.c.

◆ compute_tree_index

#define compute_tree_index (   S,
 
)
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));\
}\
}
#define S(mp)
#define NTREEBINS
Definition: dlmalloc.c:1155
#define TREEBIN_SHIFT
Definition: dlmalloc.c:1158

Definition at line 1467 of file dlmalloc.c.

◆ CORRUPTION_ERROR_ACTION

#define CORRUPTION_ERROR_ACTION (   m)    DLM_ABORT

Definition at line 1368 of file dlmalloc.c.

◆ DEBUG

#define DEBUG   0

Definition at line 32 of file dlmalloc.c.

◆ DESTROY_LOCK

#define DESTROY_LOCK (   l)    (0)

Definition at line 391 of file dlmalloc.c.

◆ DIRECT_MMAP

#define DIRECT_MMAP (   s)    MFAIL

Definition at line 326 of file dlmalloc.c.

◆ disable_contiguous

#define disable_contiguous (   M)    ((M)->mflags |= USE_NONCONTIGUOUS_BIT)

Definition at line 1245 of file dlmalloc.c.

◆ disable_expand

#define disable_expand (   M)    ((M)->mflags |= USE_NOEXPAND_BIT)

Definition at line 1247 of file dlmalloc.c.

◆ disable_lock

#define disable_lock (   M)

Definition at line 1233 of file dlmalloc.c.

◆ disable_mmap

#define disable_mmap (   M)

Definition at line 1241 of file dlmalloc.c.

◆ disable_trace

#define disable_trace (   M)    ((M)->mflags &= ~USE_TRACE_BIT)

Definition at line 1250 of file dlmalloc.c.

◆ enable_lock

#define enable_lock (   M)    ((M)->mflags |= USE_LOCK_BIT)

Definition at line 1229 of file dlmalloc.c.

◆ enable_mmap

#define enable_mmap (   M)    ((M)->mflags |= USE_MMAP_BIT)

Definition at line 1237 of file dlmalloc.c.

◆ enable_trace

#define enable_trace (   M)    ((M)->mflags |= USE_TRACE_BIT)

Definition at line 1249 of file dlmalloc.c.

◆ ensure_initialization

#define ensure_initialization ( )    (void)(mparams.magic != 0 || init_mparams())

Definition at line 1211 of file dlmalloc.c.

◆ EXTERN_BIT

#define EXTERN_BIT   (8U)

Definition at line 355 of file dlmalloc.c.

◆ FENCEPOST_HEAD

#define FENCEPOST_HEAD   (INUSE_BITS|SIZE_T_SIZE)

Definition at line 837 of file dlmalloc.c.

◆ FLAG4_BIT

#define FLAG4_BIT   (SIZE_T_FOUR)

Definition at line 832 of file dlmalloc.c.

◆ flag4inuse

#define flag4inuse (   p)    ((p)->head & FLAG4_BIT)

Definition at line 842 of file dlmalloc.c.

◆ FLAG_BITS

#define FLAG_BITS   (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT)

Definition at line 834 of file dlmalloc.c.

◆ fm

#define fm   gm

◆ FOUR_SIZE_T_SIZES

#define FOUR_SIZE_T_SIZES   (SIZE_T_SIZE<<2)

Definition at line 188 of file dlmalloc.c.

◆ get_foot

#define get_foot (   p,
 
)    (((mchunkptr)((char*)(p) + (s)))->prev_foot)

Definition at line 864 of file dlmalloc.c.

◆ gm

#define gm   (&_gm_)

Definition at line 1217 of file dlmalloc.c.

◆ granularity_align

#define granularity_align (   S)
Value:
static struct malloc_params mparams
Definition: dlmalloc.c:1208
#define S(mp)
#define SIZE_T_ONE
Definition: dlmalloc.c:184
size_t granularity
Definition: dlmalloc.c:1202

Definition at line 1262 of file dlmalloc.c.

◆ HALF_MAX_SIZE_T

#define HALF_MAX_SIZE_T   (MAX_SIZE_T / 2U)

Definition at line 190 of file dlmalloc.c.

◆ idx2bit

#define idx2bit (   i)    ((binmap_t)(1) << (i))

Definition at line 1504 of file dlmalloc.c.

◆ INITIAL_LOCK

#define INITIAL_LOCK (   l)    (0)

Definition at line 390 of file dlmalloc.c.

◆ insert_chunk

#define insert_chunk (   M,
  P,
  S 
)
Value:
else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); }
#define S(mp)
#define insert_large_chunk(M, X, S)
Definition: dlmalloc.c:2242
#define P(fmt,...)
#define insert_small_chunk(M, P, S)
Definition: dlmalloc.c:2164
struct malloc_tree_chunk * tchunkptr
Definition: dlmalloc.c:990
#define is_small(s)
Definition: dlmalloc.c:1413
#define M(T, mp)

Definition at line 2383 of file dlmalloc.c.

◆ insert_large_chunk

#define insert_large_chunk (   M,
  X,
  S 
)
Value:
{\
tbinptr* H;\
bindex_t I;\
compute_tree_index(S, I);\
H = treebin_at(M, I);\
X->index = I;\
X->child[0] = X->child[1] = 0;\
if (!treemap_is_marked(M, I)) {\
mark_treemap(M, I);\
*H = X;\
X->parent = (tchunkptr)H;\
X->fd = X->bk = X;\
}\
else {\
tchunkptr T = *H;\
size_t K = S << leftshift_for_tree_index(I);\
for (;;) {\
if (chunksize(T) != S) {\
tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\
K <<= 1;\
if (*C != 0)\
T = *C;\
else if (RTCHECK(ok_address(M, C))) {\
*C = X;\
X->parent = T;\
X->fd = X->bk = X;\
break;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
break;\
}\
}\
else {\
tchunkptr F = T->fd;\
if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\
T->fd = F->bk = X;\
X->fd = F;\
X->bk = T;\
X->parent = 0;\
break;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
break;\
}\
}\
}\
}\
}
#define RTCHECK(e)
Definition: dlmalloc.c:1629
#define treemap_is_marked(M, i)
Definition: dlmalloc.c:1513
#define S(mp)
#define leftshift_for_tree_index(i)
Definition: dlmalloc.c:1491
struct malloc_tree_chunk * tchunkptr
Definition: dlmalloc.c:990
#define SIZE_T_BITSIZE
Definition: dlmalloc.c:179
#define SIZE_T_ONE
Definition: dlmalloc.c:184
#define ok_address(M, a)
Definition: dlmalloc.c:1598
#define treebin_at(M, i)
Definition: dlmalloc.c:1420
#define chunksize(p)
Definition: dlmalloc.c:846
#define M(T, mp)
#define F(n, v, s)
Definition: cuckoo_common.h:38

Definition at line 2242 of file dlmalloc.c.

◆ insert_small_chunk

#define insert_small_chunk (   M,
  P,
  S 
)
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;\
}
#define RTCHECK(e)
Definition: dlmalloc.c:1629
#define smallmap_is_marked(M, i)
Definition: dlmalloc.c:1509
#define S(mp)
#define P(fmt,...)
#define small_index(s)
Definition: dlmalloc.c:1414
#define MIN_CHUNK_SIZE
Definition: dlmalloc.c:798
#define smallbin_at(M, i)
Definition: dlmalloc.c:1419
#define ok_address(M, a)
Definition: dlmalloc.c:1598
#define M(T, mp)
#define F(n, v, s)
Definition: cuckoo_common.h:38

Definition at line 2164 of file dlmalloc.c.

◆ internal_free

#define internal_free (   m,
  mem 
)    dlfree(mem)

Definition at line 2405 of file dlmalloc.c.

◆ internal_malloc

#define internal_malloc (   m,
 
)    dlmalloc(b)

Definition at line 2404 of file dlmalloc.c.

◆ INUSE_BITS

#define INUSE_BITS   (PINUSE_BIT|CINUSE_BIT)

Definition at line 833 of file dlmalloc.c.

◆ is_aligned

#define is_aligned (   A)    (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)

Definition at line 196 of file dlmalloc.c.

◆ is_extern_segment

#define is_extern_segment (   S)    ((S)->sflags & EXTERN_BIT)

Definition at line 1061 of file dlmalloc.c.

◆ is_global

#define is_global (   M)    ((M) == &_gm_)

Definition at line 1218 of file dlmalloc.c.

◆ is_granularity_aligned

#define is_granularity_aligned (   S)    (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)

Definition at line 1279 of file dlmalloc.c.

◆ is_initialized

#define is_initialized (   M)    ((M)->top != 0)

Definition at line 1222 of file dlmalloc.c.

◆ is_inuse

#define is_inuse (   p)    (((p)->head & INUSE_BITS) != PINUSE_BIT)

Definition at line 843 of file dlmalloc.c.

◆ is_mmapped

#define is_mmapped (   p)    (((p)->head & INUSE_BITS) == 0)

Definition at line 844 of file dlmalloc.c.

◆ is_mmapped_segment

#define is_mmapped_segment (   S)    ((S)->sflags & USE_MMAP_BIT)

Definition at line 1060 of file dlmalloc.c.

◆ is_page_aligned

#define is_page_aligned (   S)    (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)

Definition at line 1277 of file dlmalloc.c.

◆ is_small

#define is_small (   s)    (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)

Definition at line 1413 of file dlmalloc.c.

◆ least_bit

#define least_bit (   x)    ((x) & -(x))

Definition at line 1516 of file dlmalloc.c.

◆ left_bits

#define left_bits (   x)    ((x<<1) | -(x<<1))

Definition at line 1519 of file dlmalloc.c.

◆ leftmost_child

#define leftmost_child (   t)    ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])

Definition at line 994 of file dlmalloc.c.

◆ leftshift_for_tree_index

#define leftshift_for_tree_index (   i)
Value:
((i == NTREEBINS-1)? 0 : \
((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))
#define NTREEBINS
Definition: dlmalloc.c:1155
int i
#define SIZE_T_BITSIZE
Definition: dlmalloc.c:179
#define SIZE_T_ONE
Definition: dlmalloc.c:184
#define TREEBIN_SHIFT
Definition: dlmalloc.c:1158

Definition at line 1491 of file dlmalloc.c.

◆ LOCK_AT_FORK

#define LOCK_AT_FORK   0

Definition at line 106 of file dlmalloc.c.

◆ malloc_getpagesize

#define malloc_getpagesize   sysconf(_SC_PAGE_SIZE)

Definition at line 136 of file dlmalloc.c.

◆ mark_inuse_foot

#define mark_inuse_foot (   M,
  p,
 
)

Definition at line 1639 of file dlmalloc.c.

◆ mark_smallmap

#define mark_smallmap (   M,
  i 
)    ((M)->smallmap |= idx2bit(i))

Definition at line 1507 of file dlmalloc.c.

◆ mark_treemap

#define mark_treemap (   M,
  i 
)    ((M)->treemap |= idx2bit(i))

Definition at line 1511 of file dlmalloc.c.

◆ MAX_REQUEST

#define MAX_REQUEST   ((-MIN_CHUNK_SIZE) << 2)

Definition at line 808 of file dlmalloc.c.

◆ MAX_SMALL_REQUEST

#define MAX_SMALL_REQUEST   (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)

Definition at line 1161 of file dlmalloc.c.

◆ MAX_SMALL_SIZE

#define MAX_SMALL_SIZE   (MIN_LARGE_SIZE - SIZE_T_ONE)

Definition at line 1160 of file dlmalloc.c.

◆ MCHUNK_SIZE

#define MCHUNK_SIZE   (sizeof(mchunk))

Definition at line 784 of file dlmalloc.c.

◆ mem2chunk

#define mem2chunk (   mem)    ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))

Definition at line 803 of file dlmalloc.c.

◆ MFAIL

#define MFAIL   ((void*)(MAX_SIZE_T))

Definition at line 213 of file dlmalloc.c.

◆ MIN_CHUNK_SIZE

#define MIN_CHUNK_SIZE   ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)

Definition at line 798 of file dlmalloc.c.

◆ MIN_LARGE_SIZE

#define MIN_LARGE_SIZE   (SIZE_T_ONE << TREEBIN_SHIFT)

Definition at line 1159 of file dlmalloc.c.

◆ MIN_REQUEST

#define MIN_REQUEST   (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)

Definition at line 809 of file dlmalloc.c.

◆ MIN_SMALL_INDEX

#define MIN_SMALL_INDEX   (small_index(MIN_CHUNK_SIZE))

Definition at line 1416 of file dlmalloc.c.

◆ minsize_for_tree_index

#define minsize_for_tree_index (   i)
Value:
((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \
(((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
int i
#define SIZE_T_ONE
Definition: dlmalloc.c:184
#define TREEBIN_SHIFT
Definition: dlmalloc.c:1158

Definition at line 1496 of file dlmalloc.c.

◆ MMAP

#define MMAP (   s)    MFAIL

Definition at line 324 of file dlmalloc.c.

◆ mmap_align

#define mmap_align (   S)    page_align(S)

Definition at line 1271 of file dlmalloc.c.

◆ MMAP_CHUNK_OVERHEAD

#define MMAP_CHUNK_OVERHEAD   (TWO_SIZE_T_SIZES)

Definition at line 793 of file dlmalloc.c.

◆ MMAP_FOOT_PAD

#define MMAP_FOOT_PAD   (FOUR_SIZE_T_SIZES)

Definition at line 795 of file dlmalloc.c.

◆ MUNMAP

#define MUNMAP (   a,
 
)    (-1)

Definition at line 325 of file dlmalloc.c.

◆ next_chunk

#define next_chunk (   p)    ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS)))

Definition at line 857 of file dlmalloc.c.

◆ next_pinuse

#define next_pinuse (   p)    ((next_chunk(p)->head) & PINUSE_BIT)

Definition at line 861 of file dlmalloc.c.

◆ NSMALLBINS

#define NSMALLBINS   (32U)

Definition at line 1154 of file dlmalloc.c.

◆ NTREEBINS

#define NTREEBINS   (32U)

Definition at line 1155 of file dlmalloc.c.

◆ ok_address

#define ok_address (   M,
  a 
)    ((char*)(a) >= (M)->least_addr)

Definition at line 1598 of file dlmalloc.c.

◆ ok_inuse

#define ok_inuse (   p)    is_inuse(p)

Definition at line 1602 of file dlmalloc.c.

◆ ok_magic

#define ok_magic (   M)    (1)

Definition at line 1621 of file dlmalloc.c.

◆ ok_next

#define ok_next (   p,
 
)    ((char*)(p) < (char*)(n))

Definition at line 1600 of file dlmalloc.c.

◆ ok_pinuse

#define ok_pinuse (   p)    pinuse(p)

Definition at line 1604 of file dlmalloc.c.

◆ overhead_for

#define overhead_for (   p)    (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)

Definition at line 876 of file dlmalloc.c.

◆ pad_request

#define pad_request (   req)    (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)

Definition at line 812 of file dlmalloc.c.

◆ page_align

#define page_align (   S)    (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))

Definition at line 1258 of file dlmalloc.c.

◆ pinuse

#define pinuse (   p)    ((p)->head & PINUSE_BIT)

Definition at line 841 of file dlmalloc.c.

◆ PINUSE_BIT

#define PINUSE_BIT   (SIZE_T_ONE)

Definition at line 830 of file dlmalloc.c.

◆ POSTACTION

#define POSTACTION (   M)

Definition at line 1341 of file dlmalloc.c.

◆ PREACTION

#define PREACTION (   M)    (0)

Definition at line 1337 of file dlmalloc.c.

◆ prev_chunk

#define prev_chunk (   p)    ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) ))

Definition at line 858 of file dlmalloc.c.

◆ RELEASE_MALLOC_GLOBAL_LOCK

#define RELEASE_MALLOC_GLOBAL_LOCK ( )

Definition at line 393 of file dlmalloc.c.

◆ replace_dv

#define replace_dv (   M,
  P,
  S 
)
Value:
{\
size_t DVS = M->dvsize;\
assert(is_small(DVS));\
if (DVS != 0) {\
mchunkptr DV = M->dv;\
insert_small_chunk(M, DV, DVS);\
}\
M->dvsize = S;\
M->dv = P;\
}
#define S(mp)
#define P(fmt,...)
#define is_small(s)
Definition: dlmalloc.c:1413
#define M(T, mp)

Definition at line 2228 of file dlmalloc.c.

◆ request2size

#define request2size (   req)    (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))

Definition at line 816 of file dlmalloc.c.

◆ RTCHECK

#define RTCHECK (   e)    (e)

Definition at line 1629 of file dlmalloc.c.

◆ same_or_left_bits

#define same_or_left_bits (   x)    ((x) | -(x))

Definition at line 1522 of file dlmalloc.c.

◆ segment_holds

#define segment_holds (   S,
  A 
)    ((char*)(A) >= S->base && (char*)(A) < S->base + S->size)

Definition at line 1283 of file dlmalloc.c.

◆ set_flag4

#define set_flag4 (   p)    ((p)->head |= FLAG4_BIT)

Definition at line 849 of file dlmalloc.c.

◆ set_foot

#define set_foot (   p,
 
)    (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s))

Definition at line 865 of file dlmalloc.c.

◆ set_free_with_pinuse

#define set_free_with_pinuse (   p,
  s,
 
)    (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))

Definition at line 872 of file dlmalloc.c.

◆ set_inuse

#define set_inuse (   M,
  p,
 
)
Value:
((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
#define PINUSE_BIT
Definition: dlmalloc.c:830
#define CINUSE_BIT
Definition: dlmalloc.c:831

Definition at line 1644 of file dlmalloc.c.

◆ set_inuse_and_pinuse

#define set_inuse_and_pinuse (   M,
  p,
 
)
Value:
((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT)
struct malloc_chunk * mchunkptr
Definition: dlmalloc.c:776
#define PINUSE_BIT
Definition: dlmalloc.c:830
#define CINUSE_BIT
Definition: dlmalloc.c:831

Definition at line 1649 of file dlmalloc.c.

◆ set_lock

#define set_lock (   M,
 
)
Value:
((M)->mflags = (L)?\
((M)->mflags | USE_LOCK_BIT) :\
((M)->mflags & ~USE_LOCK_BIT))
#define USE_LOCK_BIT
Definition: dlmalloc.c:389
#define M(T, mp)

Definition at line 1252 of file dlmalloc.c.

◆ set_size_and_pinuse_of_free_chunk

#define set_size_and_pinuse_of_free_chunk (   p,
 
)    ((p)->head = (s|PINUSE_BIT), set_foot(p, s))

Definition at line 868 of file dlmalloc.c.

◆ set_size_and_pinuse_of_inuse_chunk

#define set_size_and_pinuse_of_inuse_chunk (   M,
  p,
 
)    ((p)->head = (s|PINUSE_BIT|CINUSE_BIT))

Definition at line 1654 of file dlmalloc.c.

◆ should_trim

#define should_trim (   M,
 
)    ((s) > (M)->trim_check)

Definition at line 1309 of file dlmalloc.c.

◆ SIX_SIZE_T_SIZES

#define SIX_SIZE_T_SIZES   (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)

Definition at line 189 of file dlmalloc.c.

◆ SIZE_T_BITSIZE

#define SIZE_T_BITSIZE   (sizeof(size_t) << 3)

Definition at line 179 of file dlmalloc.c.

◆ SIZE_T_FOUR

#define SIZE_T_FOUR   ((size_t)4)

Definition at line 186 of file dlmalloc.c.

◆ SIZE_T_ONE

#define SIZE_T_ONE   ((size_t)1)

Definition at line 184 of file dlmalloc.c.

◆ SIZE_T_SIZE

#define SIZE_T_SIZE   (sizeof(size_t))

Definition at line 178 of file dlmalloc.c.

◆ SIZE_T_TWO

#define SIZE_T_TWO   ((size_t)2)

Definition at line 185 of file dlmalloc.c.

◆ SIZE_T_ZERO

#define SIZE_T_ZERO   ((size_t)0)

Definition at line 183 of file dlmalloc.c.

◆ small_index

#define small_index (   s)    (bindex_t)((s) >> SMALLBIN_SHIFT)

Definition at line 1414 of file dlmalloc.c.

◆ small_index2size

#define small_index2size (   i)    ((i) << SMALLBIN_SHIFT)

Definition at line 1415 of file dlmalloc.c.

◆ smallbin_at

#define smallbin_at (   M,
  i 
)    ((sbinptr)((char*)&((M)->smallbins[(i)<<1])))

Definition at line 1419 of file dlmalloc.c.

◆ SMALLBIN_SHIFT

#define SMALLBIN_SHIFT   (3U)

Definition at line 1156 of file dlmalloc.c.

◆ SMALLBIN_WIDTH

#define SMALLBIN_WIDTH   (SIZE_T_ONE << SMALLBIN_SHIFT)

Definition at line 1157 of file dlmalloc.c.

◆ smallmap_is_marked

#define smallmap_is_marked (   M,
  i 
)    ((M)->smallmap & idx2bit(i))

Definition at line 1509 of file dlmalloc.c.

◆ SYS_ALLOC_PADDING

#define SYS_ALLOC_PADDING   (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)

Definition at line 1275 of file dlmalloc.c.

◆ TOP_FOOT_SIZE

#define TOP_FOOT_SIZE   (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)

Definition at line 1319 of file dlmalloc.c.

◆ treebin_at

#define treebin_at (   M,
  i 
)    (&((M)->treebins[i]))

Definition at line 1420 of file dlmalloc.c.

◆ TREEBIN_SHIFT

#define TREEBIN_SHIFT   (8U)

Definition at line 1158 of file dlmalloc.c.

◆ treemap_is_marked

#define treemap_is_marked (   M,
  i 
)    ((M)->treemap & idx2bit(i))

Definition at line 1513 of file dlmalloc.c.

◆ TWO_SIZE_T_SIZES

#define TWO_SIZE_T_SIZES   (SIZE_T_SIZE<<1)

Definition at line 187 of file dlmalloc.c.

◆ unlink_chunk

#define unlink_chunk (   M,
  P,
  S 
)
Value:
else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); }
#define S(mp)
#define unlink_small_chunk(M, P, S)
Definition: dlmalloc.c:2183
#define unlink_large_chunk(M, X)
Definition: dlmalloc.c:2310
#define P(fmt,...)
struct malloc_tree_chunk * tchunkptr
Definition: dlmalloc.c:990
#define is_small(s)
Definition: dlmalloc.c:1413
#define M(T, mp)

Definition at line 2387 of file dlmalloc.c.

◆ unlink_first_small_chunk

#define unlink_first_small_chunk (   M,
  B,
  P,
 
)
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) && F->bk == P)) {\
F->bk = B;\
B->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}
#define RTCHECK(e)
Definition: dlmalloc.c:1629
#define small_index2size(i)
Definition: dlmalloc.c:1415
#define P(fmt,...)
#define ok_address(M, a)
Definition: dlmalloc.c:1598
#define chunksize(p)
Definition: dlmalloc.c:846
#define M(T, mp)
#define F(n, v, s)
Definition: cuckoo_common.h:38

Definition at line 2209 of file dlmalloc.c.

◆ unlink_large_chunk

#define unlink_large_chunk (   M,
 
)

Definition at line 2310 of file dlmalloc.c.

◆ unlink_small_chunk

#define unlink_small_chunk (   M,
  P,
  S 
)
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 (RTCHECK(F == smallbin_at(M,I) || (ok_address(M, F) && F->bk == P))) { \
if (B == F) {\
clear_smallmap(M, I);\
}\
else if (RTCHECK(B == smallbin_at(M,I) ||\
(ok_address(M, B) && B->fd == P))) {\
F->bk = B;\
B->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
}\
}
#define RTCHECK(e)
Definition: dlmalloc.c:1629
#define S(mp)
#define small_index2size(i)
Definition: dlmalloc.c:1415
#define P(fmt,...)
#define small_index(s)
Definition: dlmalloc.c:1414
#define smallbin_at(M, i)
Definition: dlmalloc.c:1419
#define ok_address(M, a)
Definition: dlmalloc.c:1598
#define chunksize(p)
Definition: dlmalloc.c:846
#define M(T, mp)
#define F(n, v, s)
Definition: cuckoo_common.h:38

Definition at line 2183 of file dlmalloc.c.

◆ USAGE_ERROR_ACTION

#define USAGE_ERROR_ACTION (   m,
 
)    DLM_ABORT

Definition at line 1372 of file dlmalloc.c.

◆ use_lock

#define use_lock (   M)    ((M)->mflags & USE_LOCK_BIT)

Definition at line 1228 of file dlmalloc.c.

◆ USE_LOCK_BIT

#define USE_LOCK_BIT   (0U)

Definition at line 389 of file dlmalloc.c.

◆ use_mmap

#define use_mmap (   M)    ((M)->mflags & USE_MMAP_BIT)

Definition at line 1236 of file dlmalloc.c.

◆ USE_MMAP_BIT

#define USE_MMAP_BIT   (SIZE_T_ZERO)

Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP.

Definition at line 322 of file dlmalloc.c.

◆ use_noexpand

#define use_noexpand (   M)    ((M)->mflags & USE_NOEXPAND_BIT)

Definition at line 1246 of file dlmalloc.c.

◆ USE_NOEXPAND_BIT

#define USE_NOEXPAND_BIT   (8U)

Definition at line 349 of file dlmalloc.c.

◆ use_noncontiguous

#define use_noncontiguous (   M)    ((M)->mflags & USE_NONCONTIGUOUS_BIT)

Definition at line 1244 of file dlmalloc.c.

◆ USE_NONCONTIGUOUS_BIT

#define USE_NONCONTIGUOUS_BIT   (4U)

Definition at line 346 of file dlmalloc.c.

◆ use_trace

#define use_trace (   M)    ((M)->mflags & USE_TRACE_BIT)

Definition at line 1248 of file dlmalloc.c.

◆ USE_TRACE_BIT

#define USE_TRACE_BIT   (16U)

Definition at line 352 of file dlmalloc.c.

Typedef Documentation

◆ bindex_t

typedef unsigned int bindex_t

Definition at line 778 of file dlmalloc.c.

◆ binmap_t

typedef unsigned int binmap_t

Definition at line 779 of file dlmalloc.c.

◆ flag_t

typedef unsigned int flag_t

Definition at line 780 of file dlmalloc.c.

◆ mchunk

typedef struct malloc_chunk mchunk

Definition at line 775 of file dlmalloc.c.

◆ mchunkptr

typedef struct malloc_chunk* mchunkptr

Definition at line 776 of file dlmalloc.c.

◆ msegment

typedef struct malloc_segment msegment

Definition at line 1063 of file dlmalloc.c.

◆ msegmentptr

typedef struct malloc_segment* msegmentptr

Definition at line 1064 of file dlmalloc.c.

◆ mstate

typedef struct malloc_state* mstate

Definition at line 1188 of file dlmalloc.c.

◆ sbinptr

typedef struct malloc_chunk* sbinptr

Definition at line 777 of file dlmalloc.c.

◆ tbinptr

typedef struct malloc_tree_chunk* tbinptr

Definition at line 991 of file dlmalloc.c.

◆ tchunk

typedef struct malloc_tree_chunk tchunk

Definition at line 989 of file dlmalloc.c.

◆ tchunkptr

typedef struct malloc_tree_chunk* tchunkptr

Definition at line 990 of file dlmalloc.c.

Function Documentation

◆ add_segment()

static void add_segment ( mstate  m,
char *  tbase,
size_t  tsize,
flag_t  mmapped 
)
static

Definition at line 2576 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_mparam()

static int change_mparam ( int  param_number,
int  value 
)
static

Definition at line 1786 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dispose_chunk()

static void dispose_chunk ( mstate  m,
mchunkptr  p,
size_t  psize 
)
static

Definition at line 2960 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ dlbulk_free()

size_t dlbulk_free ( void *  array[],
size_t  nelem 
)

Definition at line 3913 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlcalloc()

void* dlcalloc ( size_t  n_elements,
size_t  elem_size 
)

Definition at line 3388 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlfree()

void dlfree ( void *  mem)

Definition at line 3279 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlindependent_calloc()

void** dlindependent_calloc ( size_t  n_elements,
size_t  elem_size,
void *  chunks[] 
)

Definition at line 3902 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlindependent_comalloc()

void** dlindependent_comalloc ( size_t  n_elements,
size_t  sizes[],
void *  chunks[] 
)

Definition at line 3908 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlmallinfo()

struct dlmallinfo dlmallinfo ( void  )

Definition at line 3966 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlmalloc()

void* dlmalloc ( size_t  bytes)

Definition at line 3141 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlmalloc_footprint()

size_t dlmalloc_footprint ( void  )

Definition at line 3941 of file dlmalloc.c.

◆ dlmalloc_footprint_limit()

size_t dlmalloc_footprint_limit ( void  )

Definition at line 3949 of file dlmalloc.c.

◆ dlmalloc_max_footprint()

size_t dlmalloc_max_footprint ( void  )

Definition at line 3945 of file dlmalloc.c.

◆ dlmalloc_set_footprint_limit()

size_t dlmalloc_set_footprint_limit ( size_t  bytes)

Definition at line 3954 of file dlmalloc.c.

◆ dlmalloc_stats()

void dlmalloc_stats ( )

Definition at line 3972 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlmalloc_trim()

int dlmalloc_trim ( size_t  pad)

Definition at line 3931 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlmalloc_usable_size()

size_t dlmalloc_usable_size ( void *  mem)

Definition at line 3981 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlmallopt()

int dlmallopt ( int  param_number,
int  value 
)

Definition at line 3977 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlmemalign()

void* dlmemalign ( size_t  alignment,
size_t  bytes 
)

Definition at line 3858 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlposix_memalign()

int dlposix_memalign ( void **  pp,
size_t  alignment,
size_t  bytes 
)

Definition at line 3865 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlpvalloc()

void* dlpvalloc ( size_t  bytes)

Definition at line 3895 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlrealloc()

void* dlrealloc ( void *  oldmem,
size_t  bytes 
)

Definition at line 3782 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlrealloc_in_place()

void* dlrealloc_in_place ( void *  oldmem,
size_t  bytes 
)

Definition at line 3827 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ dlvalloc()

void* dlvalloc ( size_t  bytes)

Definition at line 3888 of file dlmalloc.c.

+ Here is the call graph for this function:

◆ has_segment_link()

static int has_segment_link ( mstate  m,
msegmentptr  ss 
)
static

Definition at line 1298 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ ialloc()

static void** ialloc ( mstate  m,
size_t  n_elements,
size_t *  sizes,
int  opts,
void *  chunks[] 
)
static

Definition at line 3568 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ init_bins()

static void init_bins ( mstate  m)
static

Definition at line 2505 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ init_mparams()

static int init_mparams ( void  )
static

Definition at line 1692 of file dlmalloc.c.

◆ init_top()

static void init_top ( mstate  m,
mchunkptr  p,
size_t  psize 
)
static

Definition at line 2490 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ internal_bulk_free()

static size_t internal_bulk_free ( mstate  m,
void *  array[],
size_t  nelem 
)
static

Definition at line 3694 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ internal_mallinfo()

static struct dlmallinfo internal_mallinfo ( mstate  m)
static

Definition at line 2081 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ internal_malloc_stats()

static void internal_malloc_stats ( mstate  m)
static

Definition at line 2122 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ internal_memalign()

static void* internal_memalign ( mstate  m,
size_t  alignment,
size_t  bytes 
)
static

Definition at line 3487 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mmap_alloc()

static void* mmap_alloc ( mstate  m,
size_t  nb 
)
static

Definition at line 2420 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ mmap_resize()

static mchunkptr mmap_resize ( mstate  m,
mchunkptr  oldp,
size_t  nb,
int  flags 
)
static

Definition at line 2452 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ prepend_alloc()

static void* prepend_alloc ( mstate  m,
char *  newbase,
char *  oldbase,
size_t  nb 
)
static

Definition at line 2534 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ release_unused_segments()

static size_t release_unused_segments ( mstate  m)
static

Definition at line 2845 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ segment_holding()

static msegmentptr segment_holding ( mstate  m,
char *  addr 
)
static

Definition at line 1287 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ sys_alloc()

static void* sys_alloc ( mstate  m,
size_t  nb 
)
static

Definition at line 2631 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sys_trim()

static int sys_trim ( mstate  m,
size_t  pad 
)
static

Definition at line 2892 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tmalloc_large()

static void* tmalloc_large ( mstate  m,
size_t  nb 
)
static

Definition at line 3031 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ tmalloc_small()

static void* tmalloc_small ( mstate  m,
size_t  nb 
)
static

Definition at line 3102 of file dlmalloc.c.

+ Here is the caller graph for this function:

◆ try_realloc_chunk()

static mchunkptr try_realloc_chunk ( mstate  m,
mchunkptr  p,
size_t  nb,
int  can_move 
)
static

Definition at line 3408 of file dlmalloc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ mparams

struct malloc_params mparams
static

Definition at line 1208 of file dlmalloc.c.