Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
Loading...
Searching...
No Matches
malloc.c File Reference
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/param.h>
#include "../alloc.h"
+ Include dependency graph for malloc.c:

Go to the source code of this file.

Data Structures

struct  mallinfo
 
struct  malloc_chunk
 
struct  malloc_tree_chunk
 
struct  malloc_segment
 
struct  malloc_state
 
struct  malloc_params
 

Macros

#define DLMALLOC_VERSION   20806
 
#define DLMALLOC_EXPORT   extern
 
#define MAX_SIZE_T   (~(size_t) 0)
 
#define USE_LOCKS
 
#define USE_SPIN_LOCKS   0
 
#define ONLY_MSPACES   0
 
#define MSPACES   0
 
#define MALLOC_ALIGNMENT   ((size_t) (2 * sizeof(void *)))
 
#define FOOTERS   0
 
#define ABORT   abort()
 
#define ABORT_ON_ASSERT_FAILURE   1
 
#define PROCEED_ON_ERROR   0
 
#define INSECURE   0
 
#define MALLOC_INSPECT_ALL   0
 
#define HAVE_MMAP   0
 
#define MMAP_CLEARS   1
 
#define HAVE_MREMAP   0
 
#define MALLOC_FAILURE_ACTION   errno = ENOMEM;
 
#define HAVE_MORECORE   1
 
#define MORECORE_DEFAULT   sbrk
 
#define MORECORE_CONTIGUOUS   1
 
#define DEFAULT_GRANULARITY   (0) /* 0 means to compute in init_mparams */
 
#define DEFAULT_TRIM_THRESHOLD   ((size_t) 2U * (size_t) 1024U * (size_t) 1024U)
 
#define DEFAULT_MMAP_THRESHOLD   MAX_SIZE_T
 
#define MAX_RELEASE_CHECK_RATE   MAX_SIZE_T
 
#define USE_BUILTIN_FFS   0
 
#define USE_DEV_RANDOM   0
 
#define NO_MALLINFO   0
 
#define MALLINFO_FIELD_TYPE   size_t
 
#define NO_MALLOC_STATS   0
 
#define NO_SEGMENT_TRAVERSAL   0
 
#define M_TRIM_THRESHOLD   (-1)
 
#define M_GRANULARITY   (-2)
 
#define M_MMAP_THRESHOLD   (-3)
 
#define _STRUCT_MALLINFO
 
#define STRUCT_MALLINFO_DECLARED   1
 
#define NOINLINE
 
#define FORCEINLINE
 
#define dlcalloc   calloc
 
#define dlfree   free
 
#define dlmalloc   malloc
 
#define dlmemalign   memalign
 
#define dlposix_memalign   posix_memalign
 
#define dlrealloc   realloc
 
#define dlrealloc_in_place   realloc_in_place
 
#define dlvalloc   valloc
 
#define dlpvalloc   pvalloc
 
#define dlmallinfo
 
#define dlmallopt   mallopt
 
#define dlmalloc_trim   malloc_trim
 
#define dlmalloc_stats
 
#define dlmalloc_usable_size   malloc_usable_size
 
#define dlmalloc_footprint
 
#define dlmalloc_max_footprint
 
#define dlmalloc_footprint_limit
 
#define dlmalloc_set_footprint_limit   malloc_set_footprint_limit
 
#define dlmalloc_inspect_all   malloc_inspect_all
 
#define dlindependent_calloc   independent_calloc
 
#define dlindependent_comalloc   independent_comalloc
 
#define dlbulk_free   bulk_free
 
#define assert(x)
 
#define DEBUG   0
 
#define LOCK_AT_FORK   0
 
#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 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)
 
#define align_offset(A)
 
#define MFAIL   ((void *) (MAX_SIZE_T))
 
#define CMFAIL   ((char *) (MFAIL)) /* defined for convenience */
 
#define CALL_MORECORE(S)
 
#define MMAP(s)
 
#define DIRECT_MMAP(s)
 
#define MUNMAP(a, s)
 
#define USE_MMAP_BIT   (SIZE_T_ZERO)
 
#define MMAP(s)
 
#define MUNMAP(a, s)
 
#define DIRECT_MMAP(s)
 
#define CALL_DIRECT_MMAP(s)
 
#define CALL_MMAP(s)
 
#define CALL_MUNMAP(a, s)
 
#define CALL_MREMAP(addr, osz, nsz, mv)
 
#define USE_NONCONTIGUOUS_BIT   (4U)
 
#define EXTERN_BIT   (8U)
 
#define USE_LOCK_BIT   (0U)
 
#define INITIAL_LOCK(l)
 
#define DESTROY_LOCK(l)
 
#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)
 
#define mem2chunk(mem)
 
#define align_as_chunk(A)
 
#define MAX_REQUEST   ((-MIN_CHUNK_SIZE) << 2)
 
#define MIN_REQUEST   (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
 
#define pad_request(req)
 
#define request2size(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)
 
#define pinuse(p)
 
#define flag4inuse(p)
 
#define is_inuse(p)
 
#define is_mmapped(p)
 
#define chunksize(p)
 
#define clear_pinuse(p)
 
#define set_flag4(p)
 
#define clear_flag4(p)
 
#define chunk_plus_offset(p, s)
 
#define chunk_minus_offset(p, s)
 
#define next_chunk(p)
 
#define prev_chunk(p)
 
#define next_pinuse(p)
 
#define get_foot(p, s)
 
#define set_foot(p, s)
 
#define set_size_and_pinuse_of_free_chunk(p, s)
 
#define set_free_with_pinuse(p, s, n)
 
#define overhead_for(p)
 
#define calloc_must_clear(p)
 
#define leftmost_child(t)
 
#define is_mmapped_segment(S)
 
#define is_extern_segment(S)
 
#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()
 
#define gm   (&_gm_)
 
#define is_global(M)
 
#define is_initialized(M)
 
#define use_lock(M)
 
#define enable_lock(M)
 
#define disable_lock(M)
 
#define use_mmap(M)
 
#define enable_mmap(M)
 
#define disable_mmap(M)
 
#define use_noncontiguous(M)
 
#define disable_contiguous(M)
 
#define set_lock(M, L)
 
#define page_align(S)
 
#define granularity_align(S)
 
#define mmap_align(S)
 
#define SYS_ALLOC_PADDING   (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)
 
#define is_page_aligned(S)
 
#define is_granularity_aligned(S)
 
#define segment_holds(S, A)
 
#define should_trim(M, s)
 
#define TOP_FOOT_SIZE    (align_offset(chunk2mem(0)) + pad_request(sizeof(struct malloc_segment)) + MIN_CHUNK_SIZE)
 
#define PREACTION(M)
 
#define POSTACTION(M)
 
#define CORRUPTION_ERROR_ACTION(m)
 
#define USAGE_ERROR_ACTION(m, p)
 
#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)
 
#define small_index(s)
 
#define small_index2size(i)
 
#define MIN_SMALL_INDEX   (small_index(MIN_CHUNK_SIZE))
 
#define smallbin_at(M, i)
 
#define treebin_at(M, i)
 
#define compute_tree_index(S, I)
 
#define bit_for_tree_index(i)
 
#define leftshift_for_tree_index(i)
 
#define minsize_for_tree_index(i)
 
#define idx2bit(i)
 
#define mark_smallmap(M, i)
 
#define clear_smallmap(M, i)
 
#define smallmap_is_marked(M, i)
 
#define mark_treemap(M, i)
 
#define clear_treemap(M, i)
 
#define treemap_is_marked(M, i)
 
#define least_bit(x)
 
#define left_bits(x)
 
#define same_or_left_bits(x)
 
#define compute_bit2idx(X, I)
 
#define ok_address(M, a)
 
#define ok_next(p, n)
 
#define ok_inuse(p)
 
#define ok_pinuse(p)
 
#define ok_magic(M)
 
#define RTCHECK(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)
 
#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)
 
#define internal_free(m, 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

DLMALLOC_EXPORT void * dlmalloc (size_t)
 
DLMALLOC_EXPORT void dlfree (void *)
 
DLMALLOC_EXPORT void * dlcalloc (size_t, size_t)
 
DLMALLOC_EXPORT void * dlrealloc (void *, size_t)
 
DLMALLOC_EXPORT void * dlrealloc_in_place (void *, size_t)
 
DLMALLOC_EXPORT void * dlmemalign (size_t, size_t)
 
DLMALLOC_EXPORT int dlposix_memalign (void **, size_t, size_t)
 
DLMALLOC_EXPORT void * dlvalloc (size_t)
 
DLMALLOC_EXPORT int dlmallopt (int, int)
 
DLMALLOC_EXPORT size_t dlmalloc_set_footprint_limit (size_t bytes)
 
DLMALLOC_EXPORT void ** dlindependent_calloc (size_t, size_t, void **)
 
DLMALLOC_EXPORT void ** dlindependent_comalloc (size_t, size_t *, void **)
 
DLMALLOC_EXPORT size_t dlbulk_free (void **, size_t n_elements)
 
DLMALLOC_EXPORT void * dlpvalloc (size_t)
 
DLMALLOC_EXPORT int dlmalloc_trim (size_t)
 
size_t dlmalloc_usable_size (void *)
 
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, 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)
 
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 ** 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)
 

Variables

static struct malloc_params mparams
 
static struct malloc_state _gm_
 

Macro Definition Documentation

◆ _STRUCT_MALLINFO

#define _STRUCT_MALLINFO

Definition at line 768 of file malloc.c.

◆ ABORT

#define ABORT   abort()

Definition at line 627 of file malloc.c.

Referenced by init_mparams().

◆ ABORT_ON_ASSERT_FAILURE

#define ABORT_ON_ASSERT_FAILURE   1

Definition at line 630 of file malloc.c.

◆ ACQUIRE_MALLOC_GLOBAL_LOCK

#define ACQUIRE_MALLOC_GLOBAL_LOCK ( )

Definition at line 1835 of file malloc.c.

Referenced by init_mparams(), sys_alloc(), and sys_trim().

◆ align_as_chunk

#define align_as_chunk ( A)
Value:
#define align_offset(A)
Definition malloc.c:1630
struct malloc_chunk * mchunkptr
Definition malloc.c:2240
#define chunk2mem(p)
Definition malloc.c:2266

Definition at line 2269 of file malloc.c.

Referenced by internal_mallinfo(), internal_malloc_stats(), prepend_alloc(), and release_unused_segments().

◆ align_offset

#define align_offset ( A)
Value:
((((size_t) (A) &CHUNK_ALIGN_MASK) == 0) ? 0 : \
#define MALLOC_ALIGNMENT
Definition malloc.c:621
#define CHUNK_ALIGN_MASK
Definition malloc.c:1624

Definition at line 1630 of file malloc.c.

Referenced by add_segment(), init_top(), and mmap_alloc().

◆ assert

◆ bit_for_tree_index

#define bit_for_tree_index ( i)
Value:
(i == NTREEBINS - 1) ? (SIZE_T_BITSIZE - 1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
#define NTREEBINS
Definition malloc.c:2621
#define TREEBIN_SHIFT
Definition malloc.c:2624
#define SIZE_T_BITSIZE
Definition malloc.c:1610

Definition at line 2956 of file malloc.c.

◆ CALL_DIRECT_MMAP

#define CALL_DIRECT_MMAP ( s)
Value:
#define DIRECT_MMAP(s)
Definition malloc.c:1745

Definition at line 1776 of file malloc.c.

Referenced by mmap_alloc().

◆ CALL_MMAP

#define CALL_MMAP ( s)
Value:
MMAP(s)
#define MMAP(s)
Definition malloc.c:1744

Definition at line 1777 of file malloc.c.

Referenced by sys_alloc().

◆ CALL_MORECORE

#define CALL_MORECORE ( S)
Value:
#define MORECORE_DEFAULT
Definition malloc.c:669

Define CALL_MORECORE

Definition at line 1736 of file malloc.c.

Referenced by sys_alloc(), and sys_trim().

◆ CALL_MREMAP

#define CALL_MREMAP ( addr,
osz,
nsz,
mv )
Value:
#define MFAIL
Definition malloc.c:1644

Define CALL_MREMAP

Definition at line 1791 of file malloc.c.

Referenced by mmap_resize(), and sys_trim().

◆ CALL_MUNMAP

#define CALL_MUNMAP ( a,
s )
Value:
MUNMAP((a), (s))
#define MUNMAP(a, s)
Definition malloc.c:1747

Definition at line 1778 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), release_unused_segments(), and sys_trim().

◆ calloc_must_clear

#define calloc_must_clear ( p)
Value:
#define is_mmapped(p)
Definition malloc.c:2308

Definition at line 2345 of file malloc.c.

Referenced by dlcalloc().

◆ check_free_chunk

#define check_free_chunk ( M,
P )

Definition at line 2851 of file malloc.c.

Referenced by dlfree(), and prepend_alloc().

◆ check_inuse_chunk

#define check_inuse_chunk ( M,
P )

◆ check_malloc_state

#define check_malloc_state ( M)

Definition at line 2855 of file malloc.c.

Referenced by internal_mallinfo(), and internal_malloc_stats().

◆ check_malloced_chunk

#define check_malloced_chunk ( M,
P,
N )

Definition at line 2853 of file malloc.c.

Referenced by dlmalloc(), prepend_alloc(), and sys_alloc().

◆ check_mmapped_chunk

#define check_mmapped_chunk ( M,
P )

Definition at line 2854 of file malloc.c.

Referenced by mmap_alloc(), and mmap_resize().

◆ check_top_chunk

#define check_top_chunk ( M,
P )

Definition at line 2856 of file malloc.c.

Referenced by add_segment(), dlmalloc(), prepend_alloc(), sys_alloc(), and sys_trim().

◆ chunk2mem

#define chunk2mem ( p)

◆ CHUNK_ALIGN_MASK

#define CHUNK_ALIGN_MASK   (MALLOC_ALIGNMENT - SIZE_T_ONE)

Definition at line 1624 of file malloc.c.

Referenced by add_segment(), mmap_alloc(), and mmap_resize().

◆ chunk_minus_offset

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

Definition at line 2318 of file malloc.c.

Referenced by dispose_chunk(), and dlfree().

◆ CHUNK_OVERHEAD

#define CHUNK_OVERHEAD   (SIZE_T_SIZE)

Definition at line 2253 of file malloc.c.

Referenced by ialloc(), and internal_memalign().

◆ chunk_plus_offset

#define chunk_plus_offset ( p,
s )

◆ chunksize

◆ cinuse

#define cinuse ( p)
Value:
((p)->head & CINUSE_BIT)
#define CINUSE_BIT
Definition malloc.c:2295

Definition at line 2304 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), and try_realloc_chunk().

◆ CINUSE_BIT

#define CINUSE_BIT   (SIZE_T_TWO)

Definition at line 2295 of file malloc.c.

◆ clear_flag4

#define clear_flag4 ( p)
Value:
((p)->head &= ~FLAG4_BIT)
#define FLAG4_BIT
Definition malloc.c:2296

Definition at line 2314 of file malloc.c.

◆ clear_pinuse

#define clear_pinuse ( p)
Value:
((p)->head &= ~PINUSE_BIT)
#define PINUSE_BIT
Definition malloc.c:2294

Definition at line 2312 of file malloc.c.

Referenced by try_realloc_chunk().

◆ clear_smallmap

#define clear_smallmap ( M,
i )
Value:
((M)->smallmap &= ~idx2bit(i))
#define idx2bit(i)
Definition malloc.c:2973

Definition at line 2977 of file malloc.c.

◆ clear_treemap

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

Definition at line 2981 of file malloc.c.

◆ CMFAIL

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

Definition at line 1645 of file malloc.c.

Referenced by mmap_alloc(), mmap_resize(), sys_alloc(), and sys_trim().

◆ compute_bit2idx

#define compute_bit2idx ( X,
I )
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 malloc.c:2242

Definition at line 3023 of file malloc.c.

Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().

◆ compute_tree_index

#define compute_tree_index ( S,
I )
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 2936 of file malloc.c.

Referenced by tmalloc_large().

◆ CORRUPTION_ERROR_ACTION

#define CORRUPTION_ERROR_ACTION ( m)
Value:
#define ABORT
Definition malloc.c:627

Definition at line 2837 of file malloc.c.

Referenced by dispose_chunk(), internal_bulk_free(), tmalloc_large(), and tmalloc_small().

◆ DEBUG

#define DEBUG   0

Definition at line 1463 of file malloc.c.

◆ DEFAULT_GRANULARITY

#define DEFAULT_GRANULARITY   (0) /* 0 means to compute in init_mparams */

Definition at line 676 of file malloc.c.

Referenced by init_mparams().

◆ DEFAULT_MMAP_THRESHOLD

#define DEFAULT_MMAP_THRESHOLD   MAX_SIZE_T

Definition at line 692 of file malloc.c.

Referenced by init_mparams().

◆ DEFAULT_TRIM_THRESHOLD

#define DEFAULT_TRIM_THRESHOLD   ((size_t) 2U * (size_t) 1024U * (size_t) 1024U)

Definition at line 683 of file malloc.c.

Referenced by init_mparams().

◆ DESTROY_LOCK

#define DESTROY_LOCK ( l)
Value:
(0)

Definition at line 1834 of file malloc.c.

◆ DIRECT_MMAP [1/2]

#define DIRECT_MMAP ( s)
Value:
MMAP(s)

Definition at line 1745 of file malloc.c.

◆ DIRECT_MMAP [2/2]

#define DIRECT_MMAP ( s)
Value:

Definition at line 1745 of file malloc.c.

◆ disable_contiguous

#define disable_contiguous ( M)
Value:
((M)->mflags |= USE_NONCONTIGUOUS_BIT)
#define USE_NONCONTIGUOUS_BIT
Definition malloc.c:1795

Definition at line 2713 of file malloc.c.

Referenced by sys_alloc().

◆ disable_lock

#define disable_lock ( M)

Definition at line 2701 of file malloc.c.

◆ disable_mmap

#define disable_mmap ( M)

Definition at line 2709 of file malloc.c.

Referenced by ialloc().

◆ dlbulk_free

#define dlbulk_free   bulk_free

Definition at line 845 of file malloc.c.

◆ dlcalloc

#define dlcalloc   calloc

Definition at line 824 of file malloc.c.

◆ dlfree

#define dlfree   free

Definition at line 825 of file malloc.c.

Referenced by dlrealloc().

◆ dlindependent_calloc

#define dlindependent_calloc   independent_calloc

Definition at line 843 of file malloc.c.

◆ dlindependent_comalloc

#define dlindependent_comalloc   independent_comalloc

Definition at line 844 of file malloc.c.

◆ dlmallinfo

struct mallinfo dlmallinfo
Value:

Definition at line 5492 of file malloc.c.

Referenced by dlmalloc_inspect_all().

◆ dlmalloc

#define dlmalloc   malloc

Definition at line 826 of file malloc.c.

Referenced by dlcalloc(), dlmemalign(), dlposix_memalign(), and dlrealloc().

◆ DLMALLOC_EXPORT

#define DLMALLOC_EXPORT   extern

Definition at line 532 of file malloc.c.

Referenced by dlbulk_free(), dlindependent_calloc(), and dlindependent_comalloc().

◆ dlmalloc_footprint

size_t dlmalloc_footprint
Value:
malloc_footprint

Definition at line 5461 of file malloc.c.

◆ dlmalloc_footprint_limit

size_t dlmalloc_footprint_limit
Value:
malloc_footprint_limit

Definition at line 5471 of file malloc.c.

◆ dlmalloc_inspect_all

#define dlmalloc_inspect_all   malloc_inspect_all

Definition at line 842 of file malloc.c.

◆ dlmalloc_max_footprint

size_t dlmalloc_max_footprint
Value:
malloc_max_footprint

Definition at line 5466 of file malloc.c.

◆ dlmalloc_set_footprint_limit

#define dlmalloc_set_footprint_limit   malloc_set_footprint_limit

Definition at line 841 of file malloc.c.

◆ dlmalloc_stats

void dlmalloc_stats
Value:
malloc_stats

Definition at line 5500 of file malloc.c.

◆ dlmalloc_trim

#define dlmalloc_trim   malloc_trim

Definition at line 835 of file malloc.c.

◆ dlmalloc_usable_size

#define dlmalloc_usable_size   malloc_usable_size

Definition at line 837 of file malloc.c.

◆ DLMALLOC_VERSION

#define DLMALLOC_VERSION   20806

Definition at line 528 of file malloc.c.

◆ dlmallopt

#define dlmallopt   mallopt

Definition at line 834 of file malloc.c.

◆ dlmemalign

#define dlmemalign   memalign

Definition at line 827 of file malloc.c.

Referenced by dlpvalloc(), and dlvalloc().

◆ dlposix_memalign

#define dlposix_memalign   posix_memalign

Definition at line 828 of file malloc.c.

◆ dlpvalloc

#define dlpvalloc   pvalloc

Definition at line 832 of file malloc.c.

◆ dlrealloc

#define dlrealloc   realloc

Definition at line 829 of file malloc.c.

◆ dlrealloc_in_place

#define dlrealloc_in_place   realloc_in_place

Definition at line 830 of file malloc.c.

◆ dlvalloc

#define dlvalloc   valloc

Definition at line 831 of file malloc.c.

◆ enable_lock

#define enable_lock ( M)
Value:
((M)->mflags |= USE_LOCK_BIT)
#define USE_LOCK_BIT
Definition malloc.c:1832

Definition at line 2697 of file malloc.c.

◆ enable_mmap

#define enable_mmap ( M)
Value:
((M)->mflags |= USE_MMAP_BIT)
#define USE_MMAP_BIT
Definition malloc.c:1771

Definition at line 2705 of file malloc.c.

Referenced by ialloc().

◆ ensure_initialization

#define ensure_initialization ( )
Value:
(void) (mparams.magic != 0 || init_mparams())
static int init_mparams(void)
Definition malloc.c:3160
static struct malloc_params mparams
Definition malloc.c:2676

Definition at line 2679 of file malloc.c.

Referenced by change_mparam(), dlmalloc(), dlmalloc_trim(), dlpvalloc(), dlvalloc(), ialloc(), internal_mallinfo(), internal_malloc_stats(), sys_alloc(), and sys_trim().

◆ EXTERN_BIT

#define EXTERN_BIT   (8U)

Definition at line 1798 of file malloc.c.

◆ FENCEPOST_HEAD

#define FENCEPOST_HEAD   (INUSE_BITS | SIZE_T_SIZE)

◆ FLAG4_BIT

#define FLAG4_BIT   (SIZE_T_FOUR)

Definition at line 2296 of file malloc.c.

◆ flag4inuse

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

Definition at line 2306 of file malloc.c.

◆ FLAG_BITS

#define FLAG_BITS   (PINUSE_BIT | CINUSE_BIT | FLAG4_BIT)

Definition at line 2298 of file malloc.c.

◆ fm

#define fm   gm

Referenced by dlfree().

◆ FOOTERS

#define FOOTERS   0

Definition at line 624 of file malloc.c.

◆ FORCEINLINE

#define FORCEINLINE

Definition at line 816 of file malloc.c.

◆ FOUR_SIZE_T_SIZES

#define FOUR_SIZE_T_SIZES   (SIZE_T_SIZE << 2)

Definition at line 1619 of file malloc.c.

Referenced by add_segment().

◆ get_foot

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

Definition at line 2328 of file malloc.c.

◆ gm

◆ granularity_align

#define granularity_align ( S)
Value:
(((S) + (mparams.granularity - SIZE_T_ONE)) \
& ~(mparams.granularity - SIZE_T_ONE))
#define SIZE_T_ONE
Definition malloc.c:1615

Definition at line 2725 of file malloc.c.

Referenced by dlmalloc_set_footprint_limit(), and sys_alloc().

◆ HALF_MAX_SIZE_T

#define HALF_MAX_SIZE_T   (MAX_SIZE_T / 2U)

Definition at line 1621 of file malloc.c.

Referenced by sys_alloc(), and sys_trim().

◆ HAVE_MMAP

#define HAVE_MMAP   0

Definition at line 643 of file malloc.c.

◆ HAVE_MORECORE

#define HAVE_MORECORE   1

Definition at line 663 of file malloc.c.

Referenced by sys_alloc(), and sys_trim().

◆ HAVE_MREMAP

#define HAVE_MREMAP   0

Definition at line 653 of file malloc.c.

◆ idx2bit

#define idx2bit ( i)
Value:
((binmap_t) (1) << (i))
unsigned int binmap_t
Definition malloc.c:2243

Definition at line 2973 of file malloc.c.

Referenced by dlmalloc(), and tmalloc_large().

◆ INITIAL_LOCK

#define INITIAL_LOCK ( l)
Value:
(0)

Definition at line 1833 of file malloc.c.

Referenced by init_mparams().

◆ INSECURE

#define INSECURE   0

Definition at line 637 of file malloc.c.

◆ insert_chunk

#define insert_chunk ( M,
P,
S )
Value:
if (is_small(S)) insert_small_chunk(M, P, S) \
else { tchunkptr TP = (tchunkptr) (P); insert_large_chunk(M, TP, S); }
#define is_small(s)
Definition malloc.c:2882
#define insert_large_chunk(M, X, S)
Definition malloc.c:3741
#define insert_small_chunk(M, P, S)
Definition malloc.c:3659
struct malloc_tree_chunk * tchunkptr
Definition malloc.c:2455

Definition at line 3884 of file malloc.c.

Referenced by add_segment(), dispose_chunk(), prepend_alloc(), and tmalloc_large().

◆ insert_large_chunk

#define insert_large_chunk ( M,
X,
S )

Definition at line 3741 of file malloc.c.

Referenced by dlfree(), and release_unused_segments().

◆ insert_small_chunk

#define insert_small_chunk ( M,
P,
S )
Value:
{ \
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 ok_address(M, a)
Definition malloc.c:3067
#define small_index(s)
Definition malloc.c:2883
#define smallmap_is_marked(M, i)
Definition malloc.c:2978
#define smallbin_at(M, i)
Definition malloc.c:2888
#define MIN_CHUNK_SIZE
Definition malloc.c:2262
#define RTCHECK(e)
Definition malloc.c:3094
struct malloc_chunk * fd
Definition malloc.c:2235
struct malloc_chunk * bk
Definition malloc.c:2236

Definition at line 3659 of file malloc.c.

Referenced by dlfree().

◆ internal_free

#define internal_free ( m,
mem )
Value:
dlfree(mem)
#define dlfree
Definition malloc.c:825

Definition at line 3906 of file malloc.c.

Referenced by dlrealloc().

◆ internal_malloc

#define internal_malloc ( m,
b )
Value:
#define dlmalloc
Definition malloc.c:826

Definition at line 3905 of file malloc.c.

Referenced by dlrealloc(), ialloc(), and internal_memalign().

◆ INUSE_BITS

#define INUSE_BITS   (PINUSE_BIT | CINUSE_BIT)

Definition at line 2297 of file malloc.c.

Referenced by dispose_chunk(), and dlfree().

◆ is_aligned

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

Definition at line 1627 of file malloc.c.

Referenced by add_segment(), and mmap_alloc().

◆ is_extern_segment

#define is_extern_segment ( S)
Value:
((S)->sflags & EXTERN_BIT)
#define EXTERN_BIT
Definition malloc.c:1798

Definition at line 2527 of file malloc.c.

Referenced by release_unused_segments(), sys_alloc(), and sys_trim().

◆ is_global

#define is_global ( M)
Value:
((M) == &_gm_)
static struct malloc_state _gm_
Definition malloc.c:2684

Definition at line 2686 of file malloc.c.

Referenced by sys_alloc().

◆ is_granularity_aligned

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

Definition at line 2742 of file malloc.c.

◆ is_initialized

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

Definition at line 2690 of file malloc.c.

Referenced by internal_mallinfo(), internal_malloc_stats(), sys_alloc(), and sys_trim().

◆ is_inuse

#define is_inuse ( p)
Value:
(((p)->head & INUSE_BITS) != PINUSE_BIT)
#define INUSE_BITS
Definition malloc.c:2297

Definition at line 2307 of file malloc.c.

Referenced by dlmalloc_usable_size(), internal_mallinfo(), internal_malloc_stats(), prepend_alloc(), and release_unused_segments().

◆ is_mmapped

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

Definition at line 2308 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), ialloc(), internal_memalign(), and try_realloc_chunk().

◆ is_mmapped_segment

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

Definition at line 2526 of file malloc.c.

Referenced by release_unused_segments(), and sys_trim().

◆ is_page_aligned

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

Definition at line 2740 of file malloc.c.

Referenced by sys_alloc().

◆ is_small

#define is_small ( s)
Value:
#define SMALLBIN_SHIFT
Definition malloc.c:2622
#define NSMALLBINS
Definition malloc.c:2620

Definition at line 2882 of file malloc.c.

Referenced by dlfree(), and mmap_resize().

◆ least_bit

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

Definition at line 2985 of file malloc.c.

Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().

◆ left_bits

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

Definition at line 2988 of file malloc.c.

Referenced by dlmalloc(), and tmalloc_large().

◆ leftmost_child

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

Definition at line 2459 of file malloc.c.

Referenced by tmalloc_large(), and tmalloc_small().

◆ 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)))

Definition at line 2960 of file malloc.c.

Referenced by tmalloc_large().

◆ LOCK_AT_FORK

#define LOCK_AT_FORK   0

Definition at line 1537 of file malloc.c.

◆ M_GRANULARITY

#define M_GRANULARITY   (-2)

Definition at line 731 of file malloc.c.

Referenced by change_mparam().

◆ M_MMAP_THRESHOLD

#define M_MMAP_THRESHOLD   (-3)

Definition at line 733 of file malloc.c.

Referenced by change_mparam().

◆ M_TRIM_THRESHOLD

#define M_TRIM_THRESHOLD   (-1)

Definition at line 729 of file malloc.c.

Referenced by change_mparam().

◆ MALLINFO_FIELD_TYPE

#define MALLINFO_FIELD_TYPE   size_t

Definition at line 712 of file malloc.c.

◆ MALLOC_ALIGNMENT

#define MALLOC_ALIGNMENT   ((size_t) (2 * sizeof(void *)))

Definition at line 621 of file malloc.c.

Referenced by dlmemalign(), dlposix_memalign(), init_mparams(), and internal_memalign().

◆ MALLOC_FAILURE_ACTION

#define MALLOC_FAILURE_ACTION   errno = ENOMEM;

Definition at line 657 of file malloc.c.

Referenced by dlrealloc(), dlrealloc_in_place(), internal_memalign(), and sys_alloc().

◆ malloc_getpagesize

#define malloc_getpagesize   ((size_t) 4096U)

Definition at line 1595 of file malloc.c.

Referenced by init_mparams().

◆ MALLOC_INSPECT_ALL

#define MALLOC_INSPECT_ALL   0

Definition at line 640 of file malloc.c.

◆ mark_inuse_foot

#define mark_inuse_foot ( M,
p,
s )

Definition at line 3104 of file malloc.c.

Referenced by mmap_alloc(), and mmap_resize().

◆ mark_smallmap

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

Definition at line 2976 of file malloc.c.

◆ mark_treemap

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

Definition at line 2980 of file malloc.c.

◆ MAX_RELEASE_CHECK_RATE

#define MAX_RELEASE_CHECK_RATE   MAX_SIZE_T

Definition at line 699 of file malloc.c.

Referenced by release_unused_segments(), and sys_alloc().

◆ MAX_REQUEST

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

◆ MAX_SIZE_T

#define MAX_SIZE_T   (~(size_t) 0)

◆ MAX_SMALL_REQUEST

#define MAX_SMALL_REQUEST   (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)

Definition at line 2627 of file malloc.c.

Referenced by dlmalloc().

◆ MAX_SMALL_SIZE

#define MAX_SMALL_SIZE   (MIN_LARGE_SIZE - SIZE_T_ONE)

Definition at line 2626 of file malloc.c.

◆ MCHUNK_SIZE

#define MCHUNK_SIZE   (sizeof(mchunk))

Definition at line 2248 of file malloc.c.

Referenced by init_mparams().

◆ mem2chunk

#define mem2chunk ( mem)

◆ MFAIL

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

Definition at line 1644 of file malloc.c.

Referenced by sys_trim().

◆ MIN_CHUNK_SIZE

◆ MIN_LARGE_SIZE

#define MIN_LARGE_SIZE   (SIZE_T_ONE << TREEBIN_SHIFT)

Definition at line 2625 of file malloc.c.

◆ MIN_REQUEST

#define MIN_REQUEST   (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)

Definition at line 2273 of file malloc.c.

Referenced by dlmalloc().

◆ MIN_SMALL_INDEX

#define MIN_SMALL_INDEX   (small_index(MIN_CHUNK_SIZE))

Definition at line 2885 of file malloc.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)))

Definition at line 2965 of file malloc.c.

◆ MMAP [1/2]

#define MMAP ( s)
Value:
void * arax_mmap(size_t s)

Definition at line 1744 of file malloc.c.

◆ MMAP [2/2]

#define MMAP ( s)
Value:

Definition at line 1744 of file malloc.c.

◆ mmap_align

#define mmap_align ( S)
Value:
#define page_align(S)
Definition malloc.c:2721

Definition at line 2734 of file malloc.c.

Referenced by mmap_alloc(), and mmap_resize().

◆ MMAP_CHUNK_OVERHEAD

#define MMAP_CHUNK_OVERHEAD   (TWO_SIZE_T_SIZES)

Definition at line 2257 of file malloc.c.

◆ MMAP_CLEARS

#define MMAP_CLEARS   1

Definition at line 646 of file malloc.c.

◆ MMAP_FOOT_PAD

#define MMAP_FOOT_PAD   (FOUR_SIZE_T_SIZES)

Definition at line 2259 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), mmap_alloc(), and mmap_resize().

◆ MORECORE_CONTIGUOUS

#define MORECORE_CONTIGUOUS   1

Definition at line 671 of file malloc.c.

Referenced by sys_alloc().

◆ MORECORE_DEFAULT

#define MORECORE_DEFAULT   sbrk

Definition at line 669 of file malloc.c.

◆ MSPACES

#define MSPACES   0

Definition at line 617 of file malloc.c.

◆ MUNMAP [1/2]

#define MUNMAP ( a,
s )
Value:
void * arax_ummap(void *a, size_t s)

Definition at line 1747 of file malloc.c.

◆ MUNMAP [2/2]

#define MUNMAP ( a,
s )
Value:
(-1)

Definition at line 1747 of file malloc.c.

◆ next_chunk

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

Definition at line 2321 of file malloc.c.

Referenced by internal_bulk_free(), internal_mallinfo(), internal_malloc_stats(), and sys_alloc().

◆ next_pinuse

#define next_pinuse ( p)
Value:
((next_chunk(p)->head) & PINUSE_BIT)
#define next_chunk(p)
Definition malloc.c:2321

Definition at line 2325 of file malloc.c.

◆ NO_MALLINFO

#define NO_MALLINFO   0

Definition at line 709 of file malloc.c.

◆ NO_MALLOC_STATS

#define NO_MALLOC_STATS   0

Definition at line 715 of file malloc.c.

◆ NO_SEGMENT_TRAVERSAL

#define NO_SEGMENT_TRAVERSAL   0

Definition at line 718 of file malloc.c.

Referenced by release_unused_segments(), and sys_alloc().

◆ NOINLINE

#define NOINLINE

Definition at line 805 of file malloc.c.

◆ NSMALLBINS

#define NSMALLBINS   (32U)

Definition at line 2620 of file malloc.c.

Referenced by init_bins().

◆ NTREEBINS

#define NTREEBINS   (32U)

Definition at line 2621 of file malloc.c.

◆ ok_address

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

Definition at line 3067 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), internal_bulk_free(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().

◆ ok_inuse

#define ok_inuse ( p)
Value:
#define is_inuse(p)
Definition malloc.c:2307

Definition at line 3071 of file malloc.c.

Referenced by dlfree(), internal_bulk_free(), and try_realloc_chunk().

◆ ok_magic

#define ok_magic ( M)
Value:
(1)

Definition at line 3086 of file malloc.c.

Referenced by dlfree(), dlrealloc(), and dlrealloc_in_place().

◆ ok_next

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

Definition at line 3069 of file malloc.c.

Referenced by dlfree(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().

◆ ok_pinuse

#define ok_pinuse ( p)
Value:
#define pinuse(p)
Definition malloc.c:2305

Definition at line 3073 of file malloc.c.

Referenced by dlfree(), and try_realloc_chunk().

◆ ONLY_MSPACES

#define ONLY_MSPACES   0

Definition at line 611 of file malloc.c.

◆ overhead_for

#define overhead_for ( p)
Value:
#define MMAP_CHUNK_OVERHEAD
Definition malloc.c:2257
#define CHUNK_OVERHEAD
Definition malloc.c:2253

Definition at line 2340 of file malloc.c.

Referenced by dlmalloc_usable_size(), and dlrealloc().

◆ pad_request

#define pad_request ( req)
Value:

Definition at line 2276 of file malloc.c.

Referenced by add_segment(), and dlmalloc().

◆ page_align

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

Definition at line 2721 of file malloc.c.

Referenced by sys_alloc().

◆ pinuse

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

Definition at line 2305 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), and prepend_alloc().

◆ PINUSE_BIT

#define PINUSE_BIT   (SIZE_T_ONE)

◆ POSTACTION

◆ PREACTION

◆ prev_chunk

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

Definition at line 2322 of file malloc.c.

◆ PROCEED_ON_ERROR

#define PROCEED_ON_ERROR   0

Definition at line 633 of file malloc.c.

◆ RELEASE_MALLOC_GLOBAL_LOCK

#define RELEASE_MALLOC_GLOBAL_LOCK ( )

Definition at line 1836 of file malloc.c.

Referenced by init_mparams(), sys_alloc(), and sys_trim().

◆ 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; \
}

Definition at line 3726 of file malloc.c.

Referenced by dlmalloc(), and tmalloc_small().

◆ request2size

#define request2size ( req)
Value:
(((req) < MIN_REQUEST) ? MIN_CHUNK_SIZE : pad_request(req))
#define MIN_REQUEST
Definition malloc.c:2273
#define pad_request(req)
Definition malloc.c:2276

Definition at line 2280 of file malloc.c.

Referenced by dlrealloc(), dlrealloc_in_place(), ialloc(), and internal_memalign().

◆ RTCHECK

#define RTCHECK ( e)
Value:
(e)

Definition at line 3094 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), internal_bulk_free(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().

◆ same_or_left_bits

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

Definition at line 2991 of file malloc.c.

◆ segment_holds

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

Definition at line 2746 of file malloc.c.

Referenced by internal_mallinfo(), internal_malloc_stats(), release_unused_segments(), and sys_alloc().

◆ set_flag4

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

Definition at line 2313 of file malloc.c.

◆ set_foot

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

Definition at line 2329 of file malloc.c.

◆ set_free_with_pinuse

#define set_free_with_pinuse ( p,
s,
n )
Value:
#define set_size_and_pinuse_of_free_chunk(p, s)
Definition malloc.c:2332
#define clear_pinuse(p)
Definition malloc.c:2312

Definition at line 2336 of file malloc.c.

Referenced by add_segment(), dispose_chunk(), dlfree(), and prepend_alloc().

◆ set_inuse

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

Definition at line 3109 of file malloc.c.

Referenced by internal_bulk_free(), internal_memalign(), and try_realloc_chunk().

◆ set_inuse_and_pinuse

#define set_inuse_and_pinuse ( M,
p,
s )
Value:
((p)->head = (s | PINUSE_BIT | CINUSE_BIT), \
((mchunkptr) (((char *) (p)) + (s)))->head |= PINUSE_BIT)

Definition at line 3114 of file malloc.c.

Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().

◆ set_lock

#define set_lock ( M,
L )
Value:
((M)->mflags = (L) ? \
((M)->mflags | USE_LOCK_BIT) : \
((M)->mflags & ~USE_LOCK_BIT))

Definition at line 2715 of file malloc.c.

◆ set_size_and_pinuse_of_free_chunk

#define set_size_and_pinuse_of_free_chunk ( p,
s )
Value:
((p)->head = (s | PINUSE_BIT), set_foot(p, s))
#define set_foot(p, s)
Definition malloc.c:2329

Definition at line 2332 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), dlmalloc(), prepend_alloc(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().

◆ set_size_and_pinuse_of_inuse_chunk

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

Definition at line 3119 of file malloc.c.

Referenced by add_segment(), dlmalloc(), ialloc(), prepend_alloc(), sys_alloc(), tmalloc_large(), and tmalloc_small().

◆ should_trim

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

Definition at line 2778 of file malloc.c.

Referenced by dlfree(), and internal_bulk_free().

◆ SIX_SIZE_T_SIZES

#define SIX_SIZE_T_SIZES   (FOUR_SIZE_T_SIZES + TWO_SIZE_T_SIZES)

Definition at line 1620 of file malloc.c.

Referenced by mmap_alloc(), and mmap_resize().

◆ SIZE_T_BITSIZE

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

Definition at line 1610 of file malloc.c.

Referenced by tmalloc_large().

◆ SIZE_T_FOUR

#define SIZE_T_FOUR   ((size_t) 4)

Definition at line 1617 of file malloc.c.

◆ SIZE_T_ONE

#define SIZE_T_ONE   ((size_t) 1)

◆ SIZE_T_SIZE

#define SIZE_T_SIZE   (sizeof(size_t))

Definition at line 1609 of file malloc.c.

Referenced by add_segment(), dlmalloc(), ialloc(), mmap_alloc(), and mmap_resize().

◆ SIZE_T_TWO

#define SIZE_T_TWO   ((size_t) 2)

Definition at line 1616 of file malloc.c.

◆ SIZE_T_ZERO

#define SIZE_T_ZERO   ((size_t) 0)

Definition at line 1614 of file malloc.c.

◆ small_index

#define small_index ( s)
Value:

Definition at line 2883 of file malloc.c.

Referenced by dlmalloc().

◆ small_index2size

#define small_index2size ( i)
Value:

Definition at line 2884 of file malloc.c.

Referenced by dlmalloc().

◆ smallbin_at

#define smallbin_at ( M,
i )
Value:
((sbinptr) ((char *) &((M)->smallbins[(i) << 1])))
struct malloc_chunk * sbinptr
Definition malloc.c:2241

Definition at line 2888 of file malloc.c.

Referenced by dlmalloc(), and init_bins().

◆ SMALLBIN_SHIFT

#define SMALLBIN_SHIFT   (3U)

Definition at line 2622 of file malloc.c.

◆ SMALLBIN_WIDTH

#define SMALLBIN_WIDTH   (SIZE_T_ONE << SMALLBIN_SHIFT)

Definition at line 2623 of file malloc.c.

◆ smallmap_is_marked

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

Definition at line 2978 of file malloc.c.

◆ STRUCT_MALLINFO_DECLARED

#define STRUCT_MALLINFO_DECLARED   1

Definition at line 769 of file malloc.c.

◆ SYS_ALLOC_PADDING

#define SYS_ALLOC_PADDING   (TOP_FOOT_SIZE + MALLOC_ALIGNMENT)

Definition at line 2738 of file malloc.c.

Referenced by sys_alloc().

◆ TOP_FOOT_SIZE

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

◆ treebin_at

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

Definition at line 2889 of file malloc.c.

Referenced by tmalloc_large(), and tmalloc_small().

◆ TREEBIN_SHIFT

#define TREEBIN_SHIFT   (8U)

Definition at line 2624 of file malloc.c.

◆ treemap_is_marked

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

Definition at line 2982 of file malloc.c.

◆ TWO_SIZE_T_SIZES

#define TWO_SIZE_T_SIZES   (SIZE_T_SIZE << 1)

Definition at line 1618 of file malloc.c.

◆ unlink_chunk

#define unlink_chunk ( M,
P,
S )
Value:
if (is_small(S)) unlink_small_chunk(M, P, S) \
else { tchunkptr TP = (tchunkptr) (P); unlink_large_chunk(M, TP); }
#define unlink_large_chunk(M, X)
Definition malloc.c:3810
#define unlink_small_chunk(M, P, S)
Definition malloc.c:3679

Definition at line 3888 of file malloc.c.

Referenced by dispose_chunk(), dlfree(), prepend_alloc(), and try_realloc_chunk().

◆ unlink_first_small_chunk

#define unlink_first_small_chunk ( M,
B,
P,
I )
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 chunksize(p)
Definition malloc.c:2310
#define small_index2size(i)
Definition malloc.c:2884

Definition at line 3706 of file malloc.c.

Referenced by dlmalloc().

◆ unlink_large_chunk

#define unlink_large_chunk ( M,
X )

Definition at line 3810 of file malloc.c.

Referenced by release_unused_segments(), tmalloc_large(), and tmalloc_small().

◆ unlink_small_chunk

#define unlink_small_chunk ( M,
P,
S )
Value:
{ \
mchunkptr F = P->fd; \
mchunkptr B = P->bk; \
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); \
} \
}

Definition at line 3679 of file malloc.c.

◆ USAGE_ERROR_ACTION

#define USAGE_ERROR_ACTION ( m,
p )
Value:

Definition at line 2841 of file malloc.c.

Referenced by dlfree(), dlrealloc(), dlrealloc_in_place(), and try_realloc_chunk().

◆ USE_BUILTIN_FFS

#define USE_BUILTIN_FFS   0

Definition at line 703 of file malloc.c.

◆ USE_DEV_RANDOM

#define USE_DEV_RANDOM   0

Definition at line 706 of file malloc.c.

◆ use_lock

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

Definition at line 2696 of file malloc.c.

◆ USE_LOCK_BIT

#define USE_LOCK_BIT   (0U)

Definition at line 1832 of file malloc.c.

Referenced by init_mparams().

◆ USE_LOCKS

#define USE_LOCKS
Value:
((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
#define USE_SPIN_LOCKS

Definition at line 590 of file malloc.c.

◆ use_mmap

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

Definition at line 2704 of file malloc.c.

Referenced by ialloc(), and sys_alloc().

◆ USE_MMAP_BIT

#define USE_MMAP_BIT   (SIZE_T_ZERO)

Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP

Definition at line 1771 of file malloc.c.

Referenced by init_mparams(), and sys_alloc().

◆ use_noncontiguous

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

Definition at line 2712 of file malloc.c.

Referenced by sys_alloc().

◆ USE_NONCONTIGUOUS_BIT

#define USE_NONCONTIGUOUS_BIT   (4U)

Definition at line 1795 of file malloc.c.

Referenced by init_mparams().

◆ USE_SPIN_LOCKS

#define USE_SPIN_LOCKS   0

Definition at line 607 of file malloc.c.

Typedef Documentation

◆ bindex_t

typedef unsigned int bindex_t

Definition at line 2242 of file malloc.c.

◆ binmap_t

typedef unsigned int binmap_t

Definition at line 2243 of file malloc.c.

◆ flag_t

typedef unsigned int flag_t

Definition at line 2244 of file malloc.c.

◆ mchunk

typedef struct malloc_chunk mchunk

Definition at line 2239 of file malloc.c.

◆ mchunkptr

typedef struct malloc_chunk* mchunkptr

Definition at line 2240 of file malloc.c.

◆ msegment

typedef struct malloc_segment msegment

Definition at line 2529 of file malloc.c.

◆ msegmentptr

typedef struct malloc_segment* msegmentptr

Definition at line 2530 of file malloc.c.

◆ mstate

typedef struct malloc_state* mstate

Definition at line 2655 of file malloc.c.

◆ sbinptr

typedef struct malloc_chunk* sbinptr

Definition at line 2241 of file malloc.c.

◆ tbinptr

typedef struct malloc_tree_chunk* tbinptr

Definition at line 2456 of file malloc.c.

◆ tchunk

typedef struct malloc_tree_chunk tchunk

Definition at line 2454 of file malloc.c.

◆ tchunkptr

typedef struct malloc_tree_chunk* tchunkptr

Definition at line 2455 of file malloc.c.

Function Documentation

◆ add_segment()

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

Definition at line 4089 of file malloc.c.

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().

+ 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 3251 of file malloc.c.

References ensure_initialization, M_GRANULARITY, M_MMAP_THRESHOLD, M_TRIM_THRESHOLD, MAX_SIZE_T, and mparams.

Referenced by dlmallopt().

+ Here is the caller graph for this function:

◆ dispose_chunk()

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

◆ dlbulk_free() [1/2]

DLMALLOC_EXPORT size_t dlbulk_free ( void ** ,
size_t n_elements )

References DLMALLOC_EXPORT.

◆ dlbulk_free() [2/2]

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

Definition at line 5428 of file malloc.c.

References gm, and internal_bulk_free().

+ Here is the call graph for this function:

◆ dlcalloc()

void * dlcalloc ( size_t n_elements,
size_t elem_size )

Definition at line 4893 of file malloc.c.

References calloc_must_clear, dlmalloc, MAX_SIZE_T, and mem2chunk.

◆ dlfree()

◆ dlindependent_calloc() [1/2]

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

Definition at line 5414 of file malloc.c.

References gm, and ialloc().

+ Here is the call graph for this function:

◆ dlindependent_calloc() [2/2]

DLMALLOC_EXPORT void ** dlindependent_calloc ( size_t ,
size_t ,
void **  )

References DLMALLOC_EXPORT.

◆ dlindependent_comalloc() [1/2]

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

Definition at line 5422 of file malloc.c.

References gm, and ialloc().

+ Here is the call graph for this function:

◆ dlindependent_comalloc() [2/2]

DLMALLOC_EXPORT void ** dlindependent_comalloc ( size_t ,
size_t * ,
void **  )

References DLMALLOC_EXPORT.

◆ dlmalloc()

◆ dlmalloc_set_footprint_limit()

size_t dlmalloc_set_footprint_limit ( size_t bytes)

Definition at line 5478 of file malloc.c.

References gm, granularity_align, and MAX_SIZE_T.

◆ dlmalloc_trim()

int dlmalloc_trim ( size_t pad)

Definition at line 5449 of file malloc.c.

References ensure_initialization, gm, POSTACTION, PREACTION, and sys_trim().

+ Here is the call graph for this function:

◆ dlmalloc_usable_size()

size_t dlmalloc_usable_size ( void * mem)

Definition at line 5512 of file malloc.c.

References chunksize, is_inuse, mem2chunk, and overhead_for.

◆ dlmallopt()

int dlmallopt ( int param_number,
int value )

Definition at line 5507 of file malloc.c.

References change_mparam().

+ Here is the call graph for this function:

◆ dlmemalign()

void * dlmemalign ( size_t alignment,
size_t bytes )

Definition at line 5363 of file malloc.c.

References dlmalloc, gm, internal_memalign(), and MALLOC_ALIGNMENT.

+ Here is the call graph for this function:

◆ dlposix_memalign()

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

Definition at line 5371 of file malloc.c.

References dlmalloc, gm, internal_memalign(), MALLOC_ALIGNMENT, MAX_REQUEST, MIN_CHUNK_SIZE, and SIZE_T_ONE.

+ Here is the call graph for this function:

◆ dlpvalloc()

void * dlpvalloc ( size_t bytes)

Definition at line 5405 of file malloc.c.

References dlmemalign, ensure_initialization, mparams, and SIZE_T_ONE.

◆ dlrealloc()

void * dlrealloc ( void * oldmem,
size_t bytes )

Definition at line 5286 of file malloc.c.

References check_inuse_chunk, chunk2mem, chunksize, dlfree, dlmalloc, gm, internal_free, internal_malloc, MALLOC_FAILURE_ACTION, MAX_REQUEST, mem2chunk, ok_magic, overhead_for, POSTACTION, PREACTION, request2size, try_realloc_chunk(), and USAGE_ERROR_ACTION.

+ Here is the call graph for this function:

◆ dlrealloc_in_place()

void * dlrealloc_in_place ( void * oldmem,
size_t bytes )

Definition at line 5331 of file malloc.c.

References check_inuse_chunk, gm, MALLOC_FAILURE_ACTION, MAX_REQUEST, mem2chunk, ok_magic, POSTACTION, PREACTION, request2size, try_realloc_chunk(), and USAGE_ERROR_ACTION.

+ Here is the call graph for this function:

◆ dlvalloc()

void * dlvalloc ( size_t bytes)

Definition at line 5396 of file malloc.c.

References dlmemalign, ensure_initialization, and mparams.

◆ has_segment_link()

static int has_segment_link ( mstate m,
msegmentptr ss )
static

Definition at line 2764 of file malloc.c.

References malloc_segment::base, malloc_segment::next, malloc_state::seg, and malloc_segment::size.

Referenced by sys_trim().

+ 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 5072 of file malloc.c.

References assert, check_inuse_chunk, chunk2mem, CHUNK_OVERHEAD, chunk_plus_offset, chunksize, disable_mmap, enable_mmap, ensure_initialization, internal_malloc, is_mmapped, mem2chunk, POSTACTION, 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 caller graph for this function:

◆ init_bins()

static void init_bins ( mstate m)
static

Definition at line 4013 of file malloc.c.

References malloc_chunk::bk, malloc_chunk::fd, NSMALLBINS, and smallbin_at.

Referenced by sys_alloc().

+ Here is the caller graph for this function:

◆ init_mparams()

◆ init_top()

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

Definition at line 3996 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, and malloc_state::trim_check.

Referenced by add_segment(), sys_alloc(), and sys_trim().

+ 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 5197 of file malloc.c.

References check_inuse_chunk, chunk2mem, chunksize, CORRUPTION_ERROR_ACTION, dispose_chunk(), mem2chunk, next_chunk, ok_address, ok_inuse, POSTACTION, PREACTION, RTCHECK, set_inuse, should_trim, sys_trim(), and malloc_state::topsize.

Referenced by dlbulk_free().

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

◆ internal_mallinfo()

static struct mallinfo internal_mallinfo ( mstate m)
static

Definition at line 3569 of file malloc.c.

References align_as_chunk, mallinfo::arena, malloc_segment::base, check_malloc_state, chunksize, ensure_initialization, FENCEPOST_HEAD, malloc_state::footprint, mallinfo::fordblks, mallinfo::hblkhd, malloc_chunk::head, internal_mallinfo(), is_initialized, is_inuse, 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 internal_mallinfo().

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

◆ internal_malloc_stats()

◆ internal_memalign()

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

Definition at line 4990 of file malloc.c.

References assert, check_inuse_chunk, chunk2mem, CHUNK_OVERHEAD, chunk_plus_offset, chunksize, dispose_chunk(), malloc_chunk::head, 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 dlmemalign(), and dlposix_memalign().

+ 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 3921 of file malloc.c.

References align_offset, assert, CALL_DIRECT_MMAP, check_mmapped_chunk, chunk2mem, CHUNK_ALIGN_MASK, chunk_plus_offset, CMFAIL, FENCEPOST_HEAD, malloc_state::footprint, malloc_state::footprint_limit, malloc_chunk::head, is_aligned, malloc_state::least_addr, mark_inuse_foot, malloc_state::max_footprint, mmap_align, MMAP_FOOT_PAD, malloc_chunk::prev_foot, SIX_SIZE_T_SIZES, and SIZE_T_SIZE.

Referenced by sys_alloc().

+ 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 3955 of file malloc.c.

References CALL_MREMAP, check_mmapped_chunk, CHUNK_ALIGN_MASK, chunk_plus_offset, chunksize, CMFAIL, FENCEPOST_HEAD, malloc_state::footprint, malloc_chunk::head, is_small, malloc_state::least_addr, mark_inuse_foot, malloc_state::max_footprint, mmap_align, MMAP_FOOT_PAD, mparams, malloc_chunk::prev_foot, SIX_SIZE_T_SIZES, and SIZE_T_SIZE.

Referenced by try_realloc_chunk().

+ 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 4047 of file malloc.c.

References align_as_chunk, assert, check_free_chunk, check_malloced_chunk, check_top_chunk, chunk2mem, chunk_plus_offset, chunksize, malloc_state::dv, malloc_state::dvsize, malloc_chunk::head, insert_chunk, is_inuse, 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().

+ Here is the caller graph for this function:

◆ release_unused_segments()

static size_t release_unused_segments ( mstate m)
static

◆ segment_holding()

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

Definition at line 2750 of file malloc.c.

References malloc_segment::base, malloc_segment::next, malloc_state::seg, and malloc_segment::size.

Referenced by add_segment(), sys_alloc(), and sys_trim().

+ Here is the caller graph for this function:

◆ sys_alloc()

◆ sys_trim()

static int sys_trim ( mstate m,
size_t pad )
static

Definition at line 4405 of file malloc.c.

References ACQUIRE_MALLOC_GLOBAL_LOCK, malloc_segment::base, CALL_MORECORE, CALL_MREMAP, CALL_MUNMAP, check_top_chunk, CMFAIL, ensure_initialization, malloc_state::footprint, 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_MALLOC_GLOBAL_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 dlfree(), dlmalloc_trim(), and internal_bulk_free().

+ 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

◆ tmalloc_small()

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

Definition at line 4616 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().

+ 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 4915 of file malloc.c.

References chunk2mem, chunk_plus_offset, chunksize, cinuse, clear_pinuse, dispose_chunk(), malloc_state::dv, malloc_state::dvsize, malloc_chunk::head, is_mmapped, MIN_CHUNK_SIZE, mmap_resize(), ok_address, ok_inuse, ok_next, ok_pinuse, PINUSE_BIT, RTCHECK, set_inuse, set_size_and_pinuse_of_free_chunk, malloc_state::top, malloc_state::topsize, unlink_chunk, and USAGE_ERROR_ACTION.

Referenced by dlrealloc(), and dlrealloc_in_place().

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

Variable Documentation

◆ _gm_

struct malloc_state _gm_
static

Definition at line 2684 of file malloc.c.

◆ mparams

struct malloc_params mparams
static