![]() |
Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
|
#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"
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 |
Typedefs | |
typedef struct malloc_chunk | mchunk |
typedef struct malloc_chunk * | mchunkptr |
typedef struct malloc_chunk * | sbinptr |
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_chunk * | tchunkptr |
typedef struct malloc_tree_chunk * | tbinptr |
typedef struct malloc_segment | msegment |
typedef struct malloc_segment * | msegmentptr |
typedef struct malloc_state * | mstate |
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_ |
#define ABORT abort() |
Definition at line 627 of file malloc.c.
Referenced by init_mparams().
#define ACQUIRE_MALLOC_GLOBAL_LOCK | ( | ) |
Definition at line 1835 of file malloc.c.
Referenced by init_mparams(), sys_alloc(), and sys_trim().
#define align_as_chunk | ( | A | ) |
Definition at line 2269 of file malloc.c.
Referenced by internal_mallinfo(), internal_malloc_stats(), prepend_alloc(), and release_unused_segments().
#define align_offset | ( | A | ) |
Definition at line 1630 of file malloc.c.
Referenced by add_segment(), init_top(), and mmap_alloc().
#define assert | ( | x | ) |
Definition at line 1461 of file malloc.c.
Referenced by add_segment(), dlmalloc(), ialloc(), internal_memalign(), mmap_alloc(), prepend_alloc(), release_unused_segments(), tmalloc_large(), and tmalloc_small().
#define bit_for_tree_index | ( | i | ) |
#define CALL_DIRECT_MMAP | ( | s | ) |
#define CALL_MMAP | ( | s | ) |
#define CALL_MORECORE | ( | S | ) |
Define CALL_MORECORE
Definition at line 1736 of file malloc.c.
Referenced by sys_alloc(), and sys_trim().
#define CALL_MREMAP | ( | addr, | |
osz, | |||
nsz, | |||
mv ) |
Define CALL_MREMAP
Definition at line 1791 of file malloc.c.
Referenced by mmap_resize(), and sys_trim().
#define CALL_MUNMAP | ( | a, | |
s ) |
Definition at line 1778 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), release_unused_segments(), and sys_trim().
#define calloc_must_clear | ( | p | ) |
#define check_free_chunk | ( | M, | |
P ) |
Definition at line 2851 of file malloc.c.
Referenced by dlfree(), and prepend_alloc().
#define check_inuse_chunk | ( | M, | |
P ) |
Definition at line 2852 of file malloc.c.
Referenced by dlfree(), dlrealloc(), dlrealloc_in_place(), ialloc(), internal_bulk_free(), and internal_memalign().
#define check_malloc_state | ( | M | ) |
Definition at line 2855 of file malloc.c.
Referenced by internal_mallinfo(), and internal_malloc_stats().
#define check_malloced_chunk | ( | M, | |
P, | |||
N ) |
Definition at line 2853 of file malloc.c.
Referenced by dlmalloc(), prepend_alloc(), and sys_alloc().
#define check_mmapped_chunk | ( | M, | |
P ) |
Definition at line 2854 of file malloc.c.
Referenced by mmap_alloc(), and mmap_resize().
#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().
#define chunk2mem | ( | p | ) |
Definition at line 2266 of file malloc.c.
Referenced by add_segment(), dlmalloc(), dlrealloc(), ialloc(), init_top(), internal_bulk_free(), internal_memalign(), mmap_alloc(), prepend_alloc(), sys_alloc(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().
#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().
#define chunk_minus_offset | ( | p, | |
s ) |
Definition at line 2318 of file malloc.c.
Referenced by dispose_chunk(), and dlfree().
#define CHUNK_OVERHEAD (SIZE_T_SIZE) |
Definition at line 2253 of file malloc.c.
Referenced by ialloc(), and internal_memalign().
#define chunk_plus_offset | ( | p, | |
s ) |
Definition at line 2317 of file malloc.c.
Referenced by add_segment(), dispose_chunk(), dlfree(), dlmalloc(), ialloc(), init_top(), internal_memalign(), mmap_alloc(), mmap_resize(), prepend_alloc(), sys_alloc(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().
#define chunksize | ( | p | ) |
Definition at line 2310 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), dlmalloc(), dlmalloc_usable_size(), dlrealloc(), ialloc(), internal_bulk_free(), internal_mallinfo(), internal_malloc_stats(), internal_memalign(), mmap_resize(), prepend_alloc(), release_unused_segments(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().
#define cinuse | ( | p | ) |
Definition at line 2304 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), and try_realloc_chunk().
#define CINUSE_BIT (SIZE_T_TWO) |
#define clear_flag4 | ( | p | ) |
#define clear_pinuse | ( | p | ) |
Definition at line 2312 of file malloc.c.
Referenced by try_realloc_chunk().
#define clear_smallmap | ( | M, | |
i ) |
#define clear_treemap | ( | M, | |
i ) |
#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().
#define compute_bit2idx | ( | X, | |
I ) |
Definition at line 3023 of file malloc.c.
Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().
#define compute_tree_index | ( | S, | |
I ) |
Definition at line 2936 of file malloc.c.
Referenced by tmalloc_large().
#define CORRUPTION_ERROR_ACTION | ( | m | ) |
Definition at line 2837 of file malloc.c.
Referenced by dispose_chunk(), internal_bulk_free(), tmalloc_large(), and tmalloc_small().
#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */ |
Definition at line 676 of file malloc.c.
Referenced by init_mparams().
#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T |
Definition at line 692 of file malloc.c.
Referenced by init_mparams().
#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().
#define disable_contiguous | ( | M | ) |
Definition at line 2713 of file malloc.c.
Referenced by sys_alloc().
#define dlfree free |
Definition at line 825 of file malloc.c.
Referenced by dlrealloc().
struct mallinfo dlmallinfo |
Definition at line 5492 of file malloc.c.
Referenced by dlmalloc_inspect_all().
#define dlmalloc malloc |
Definition at line 826 of file malloc.c.
Referenced by dlcalloc(), dlmemalign(), dlposix_memalign(), and dlrealloc().
#define DLMALLOC_EXPORT extern |
Definition at line 532 of file malloc.c.
Referenced by dlbulk_free(), dlindependent_calloc(), and dlindependent_comalloc().
size_t dlmalloc_footprint_limit |
#define dlmalloc_set_footprint_limit malloc_set_footprint_limit |
#define dlmemalign memalign |
Definition at line 827 of file malloc.c.
Referenced by dlpvalloc(), and dlvalloc().
#define enable_lock | ( | M | ) |
#define enable_mmap | ( | M | ) |
Definition at line 2705 of file malloc.c.
Referenced by ialloc().
#define ensure_initialization | ( | ) |
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().
#define FENCEPOST_HEAD (INUSE_BITS | SIZE_T_SIZE) |
Definition at line 2301 of file malloc.c.
Referenced by add_segment(), internal_mallinfo(), internal_malloc_stats(), mmap_alloc(), and mmap_resize().
#define FLAG4_BIT (SIZE_T_FOUR) |
#define FLAG_BITS (PINUSE_BIT | CINUSE_BIT | FLAG4_BIT) |
#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE << 2) |
Definition at line 1619 of file malloc.c.
Referenced by add_segment().
#define get_foot | ( | p, | |
s ) |
#define gm (&_gm_) |
Definition at line 2685 of file malloc.c.
Referenced by dlbulk_free(), dlindependent_calloc(), dlindependent_comalloc(), dlmalloc(), dlmalloc_set_footprint_limit(), dlmalloc_trim(), dlmemalign(), dlposix_memalign(), dlrealloc(), dlrealloc_in_place(), and init_mparams().
#define granularity_align | ( | S | ) |
Definition at line 2725 of file malloc.c.
Referenced by dlmalloc_set_footprint_limit(), and sys_alloc().
#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) |
Definition at line 1621 of file malloc.c.
Referenced by sys_alloc(), and sys_trim().
#define HAVE_MORECORE 1 |
Definition at line 663 of file malloc.c.
Referenced by sys_alloc(), and sys_trim().
#define idx2bit | ( | i | ) |
Definition at line 2973 of file malloc.c.
Referenced by dlmalloc(), and tmalloc_large().
#define INITIAL_LOCK | ( | l | ) |
#define insert_chunk | ( | M, | |
P, | |||
S ) |
Definition at line 3884 of file malloc.c.
Referenced by add_segment(), dispose_chunk(), prepend_alloc(), and tmalloc_large().
#define insert_large_chunk | ( | M, | |
X, | |||
S ) |
Definition at line 3741 of file malloc.c.
Referenced by dlfree(), and release_unused_segments().
#define insert_small_chunk | ( | M, | |
P, | |||
S ) |
Definition at line 3659 of file malloc.c.
Referenced by dlfree().
#define internal_free | ( | m, | |
mem ) |
#define internal_malloc | ( | m, | |
b ) |
Definition at line 3905 of file malloc.c.
Referenced by dlrealloc(), ialloc(), and internal_memalign().
#define INUSE_BITS (PINUSE_BIT | CINUSE_BIT) |
Definition at line 2297 of file malloc.c.
Referenced by dispose_chunk(), and dlfree().
#define is_aligned | ( | A | ) |
Definition at line 1627 of file malloc.c.
Referenced by add_segment(), and mmap_alloc().
#define is_extern_segment | ( | S | ) |
Definition at line 2527 of file malloc.c.
Referenced by release_unused_segments(), sys_alloc(), and sys_trim().
#define is_global | ( | M | ) |
#define is_granularity_aligned | ( | S | ) |
#define is_initialized | ( | M | ) |
Definition at line 2690 of file malloc.c.
Referenced by internal_mallinfo(), internal_malloc_stats(), sys_alloc(), and sys_trim().
#define is_inuse | ( | p | ) |
Definition at line 2307 of file malloc.c.
Referenced by dlmalloc_usable_size(), internal_mallinfo(), internal_malloc_stats(), prepend_alloc(), and release_unused_segments().
#define is_mmapped | ( | p | ) |
Definition at line 2308 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), ialloc(), internal_memalign(), and try_realloc_chunk().
#define is_mmapped_segment | ( | S | ) |
Definition at line 2526 of file malloc.c.
Referenced by release_unused_segments(), and sys_trim().
#define is_page_aligned | ( | S | ) |
Definition at line 2740 of file malloc.c.
Referenced by sys_alloc().
#define is_small | ( | s | ) |
Definition at line 2882 of file malloc.c.
Referenced by dlfree(), and mmap_resize().
#define least_bit | ( | x | ) |
Definition at line 2985 of file malloc.c.
Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().
#define left_bits | ( | x | ) |
Definition at line 2988 of file malloc.c.
Referenced by dlmalloc(), and tmalloc_large().
#define leftmost_child | ( | t | ) |
Definition at line 2459 of file malloc.c.
Referenced by tmalloc_large(), and tmalloc_small().
#define leftshift_for_tree_index | ( | i | ) |
Definition at line 2960 of file malloc.c.
Referenced by tmalloc_large().
#define M_GRANULARITY (-2) |
Definition at line 731 of file malloc.c.
Referenced by change_mparam().
#define M_MMAP_THRESHOLD (-3) |
Definition at line 733 of file malloc.c.
Referenced by change_mparam().
#define M_TRIM_THRESHOLD (-1) |
Definition at line 729 of file malloc.c.
Referenced by change_mparam().
#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().
#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().
#define malloc_getpagesize ((size_t) 4096U) |
Definition at line 1595 of file malloc.c.
Referenced by init_mparams().
#define mark_inuse_foot | ( | M, | |
p, | |||
s ) |
Definition at line 3104 of file malloc.c.
Referenced by mmap_alloc(), and mmap_resize().
#define mark_smallmap | ( | M, | |
i ) |
#define mark_treemap | ( | M, | |
i ) |
#define MAX_RELEASE_CHECK_RATE MAX_SIZE_T |
Definition at line 699 of file malloc.c.
Referenced by release_unused_segments(), and sys_alloc().
#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) |
Definition at line 2272 of file malloc.c.
Referenced by dlmalloc(), dlposix_memalign(), dlrealloc(), dlrealloc_in_place(), internal_memalign(), and sys_trim().
#define MAX_SIZE_T (~(size_t) 0) |
Definition at line 587 of file malloc.c.
Referenced by change_mparam(), dlcalloc(), dlmalloc(), dlmalloc_set_footprint_limit(), init_mparams(), and sys_trim().
#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) |
Definition at line 2627 of file malloc.c.
Referenced by dlmalloc().
#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) |
#define MCHUNK_SIZE (sizeof(mchunk)) |
Definition at line 2248 of file malloc.c.
Referenced by init_mparams().
#define mem2chunk | ( | mem | ) |
Definition at line 2267 of file malloc.c.
Referenced by dlcalloc(), dlfree(), dlmalloc_usable_size(), dlrealloc(), dlrealloc_in_place(), ialloc(), internal_bulk_free(), internal_memalign(), and sys_alloc().
#define MFAIL ((void *) (MAX_SIZE_T)) |
Definition at line 1644 of file malloc.c.
Referenced by sys_trim().
#define MIN_CHUNK_SIZE ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) |
Definition at line 2262 of file malloc.c.
Referenced by add_segment(), dlmalloc(), dlposix_memalign(), init_mparams(), internal_memalign(), prepend_alloc(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().
#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) |
#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) |
Definition at line 2273 of file malloc.c.
Referenced by dlmalloc().
#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) |
#define minsize_for_tree_index | ( | i | ) |
#define MMAP | ( | s | ) |
#define mmap_align | ( | S | ) |
Definition at line 2734 of file malloc.c.
Referenced by mmap_alloc(), and mmap_resize().
#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) |
#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().
#define MORECORE_CONTIGUOUS 1 |
Definition at line 671 of file malloc.c.
Referenced by sys_alloc().
#define MUNMAP | ( | a, | |
s ) |
#define next_chunk | ( | p | ) |
Definition at line 2321 of file malloc.c.
Referenced by internal_bulk_free(), internal_mallinfo(), internal_malloc_stats(), and sys_alloc().
#define next_pinuse | ( | p | ) |
#define NO_SEGMENT_TRAVERSAL 0 |
Definition at line 718 of file malloc.c.
Referenced by release_unused_segments(), and sys_alloc().
#define NSMALLBINS (32U) |
Definition at line 2620 of file malloc.c.
Referenced by init_bins().
#define ok_address | ( | M, | |
a ) |
Definition at line 3067 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), internal_bulk_free(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().
#define ok_inuse | ( | p | ) |
Definition at line 3071 of file malloc.c.
Referenced by dlfree(), internal_bulk_free(), and try_realloc_chunk().
#define ok_magic | ( | M | ) |
Definition at line 3086 of file malloc.c.
Referenced by dlfree(), dlrealloc(), and dlrealloc_in_place().
#define ok_next | ( | p, | |
n ) |
Definition at line 3069 of file malloc.c.
Referenced by dlfree(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().
#define ok_pinuse | ( | p | ) |
Definition at line 3073 of file malloc.c.
Referenced by dlfree(), and try_realloc_chunk().
#define overhead_for | ( | p | ) |
Definition at line 2340 of file malloc.c.
Referenced by dlmalloc_usable_size(), and dlrealloc().
#define pad_request | ( | req | ) |
#define page_align | ( | S | ) |
#define pinuse | ( | p | ) |
Definition at line 2305 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), and prepend_alloc().
#define PINUSE_BIT (SIZE_T_ONE) |
Definition at line 2294 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), dlmalloc(), init_top(), prepend_alloc(), sys_alloc(), and try_realloc_chunk().
#define POSTACTION | ( | M | ) |
Definition at line 2810 of file malloc.c.
Referenced by dlfree(), dlmalloc(), dlmalloc_trim(), dlrealloc(), dlrealloc_in_place(), ialloc(), internal_bulk_free(), internal_mallinfo(), internal_malloc_stats(), and internal_memalign().
#define PREACTION | ( | M | ) |
Definition at line 2806 of file malloc.c.
Referenced by dlfree(), dlmalloc(), dlmalloc_trim(), dlrealloc(), dlrealloc_in_place(), ialloc(), internal_bulk_free(), internal_mallinfo(), internal_malloc_stats(), and internal_memalign().
#define prev_chunk | ( | p | ) |
#define RELEASE_MALLOC_GLOBAL_LOCK | ( | ) |
Definition at line 1836 of file malloc.c.
Referenced by init_mparams(), sys_alloc(), and sys_trim().
#define replace_dv | ( | M, | |
P, | |||
S ) |
Definition at line 3726 of file malloc.c.
Referenced by dlmalloc(), and tmalloc_small().
#define request2size | ( | req | ) |
Definition at line 2280 of file malloc.c.
Referenced by dlrealloc(), dlrealloc_in_place(), ialloc(), and internal_memalign().
#define RTCHECK | ( | 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().
#define segment_holds | ( | S, | |
A ) |
Definition at line 2746 of file malloc.c.
Referenced by internal_mallinfo(), internal_malloc_stats(), release_unused_segments(), and sys_alloc().
#define set_foot | ( | p, | |
s ) |
#define set_free_with_pinuse | ( | p, | |
s, | |||
n ) |
Definition at line 2336 of file malloc.c.
Referenced by add_segment(), dispose_chunk(), dlfree(), and prepend_alloc().
#define set_inuse | ( | M, | |
p, | |||
s ) |
Definition at line 3109 of file malloc.c.
Referenced by internal_bulk_free(), internal_memalign(), and try_realloc_chunk().
#define set_inuse_and_pinuse | ( | M, | |
p, | |||
s ) |
Definition at line 3114 of file malloc.c.
Referenced by dlmalloc(), tmalloc_large(), and tmalloc_small().
#define set_lock | ( | M, | |
L ) |
#define set_size_and_pinuse_of_free_chunk | ( | p, | |
s ) |
Definition at line 2332 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), dlmalloc(), prepend_alloc(), tmalloc_large(), tmalloc_small(), and try_realloc_chunk().
#define set_size_and_pinuse_of_inuse_chunk | ( | M, | |
p, | |||
s ) |
Definition at line 3119 of file malloc.c.
Referenced by add_segment(), dlmalloc(), ialloc(), prepend_alloc(), sys_alloc(), tmalloc_large(), and tmalloc_small().
#define should_trim | ( | M, | |
s ) |
Definition at line 2778 of file malloc.c.
Referenced by dlfree(), and internal_bulk_free().
#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().
#define SIZE_T_BITSIZE (sizeof(size_t) << 3) |
Definition at line 1610 of file malloc.c.
Referenced by tmalloc_large().
#define SIZE_T_ONE ((size_t) 1) |
Definition at line 1615 of file malloc.c.
Referenced by dlposix_memalign(), dlpvalloc(), init_mparams(), internal_mallinfo(), internal_memalign(), sys_trim(), and tmalloc_large().
#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().
#define small_index | ( | s | ) |
Definition at line 2883 of file malloc.c.
Referenced by dlmalloc().
#define small_index2size | ( | i | ) |
#define smallbin_at | ( | M, | |
i ) |
Definition at line 2888 of file malloc.c.
Referenced by dlmalloc(), and init_bins().
#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) |
#define smallmap_is_marked | ( | M, | |
i ) |
#define SYS_ALLOC_PADDING (TOP_FOOT_SIZE + MALLOC_ALIGNMENT) |
Definition at line 2738 of file malloc.c.
Referenced by sys_alloc().
#define TOP_FOOT_SIZE (align_offset(chunk2mem(0)) + pad_request(sizeof(struct malloc_segment)) + MIN_CHUNK_SIZE) |
Definition at line 2788 of file malloc.c.
Referenced by add_segment(), init_top(), internal_mallinfo(), internal_malloc_stats(), release_unused_segments(), sys_alloc(), and sys_trim().
#define treebin_at | ( | M, | |
i ) |
Definition at line 2889 of file malloc.c.
Referenced by tmalloc_large(), and tmalloc_small().
#define treemap_is_marked | ( | M, | |
i ) |
#define TWO_SIZE_T_SIZES (SIZE_T_SIZE << 1) |
#define unlink_chunk | ( | M, | |
P, | |||
S ) |
Definition at line 3888 of file malloc.c.
Referenced by dispose_chunk(), dlfree(), prepend_alloc(), and try_realloc_chunk().
#define unlink_first_small_chunk | ( | M, | |
B, | |||
P, | |||
I ) |
Definition at line 3706 of file malloc.c.
Referenced by dlmalloc().
#define unlink_large_chunk | ( | M, | |
X ) |
Definition at line 3810 of file malloc.c.
Referenced by release_unused_segments(), tmalloc_large(), and tmalloc_small().
#define unlink_small_chunk | ( | M, | |
P, | |||
S ) |
#define USAGE_ERROR_ACTION | ( | m, | |
p ) |
Definition at line 2841 of file malloc.c.
Referenced by dlfree(), dlrealloc(), dlrealloc_in_place(), and try_realloc_chunk().
#define use_lock | ( | M | ) |
#define USE_LOCK_BIT (0U) |
Definition at line 1832 of file malloc.c.
Referenced by init_mparams().
#define USE_LOCKS |
#define use_mmap | ( | M | ) |
Definition at line 2704 of file malloc.c.
Referenced by ialloc(), and sys_alloc().
#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().
#define use_noncontiguous | ( | M | ) |
Definition at line 2712 of file malloc.c.
Referenced by sys_alloc().
#define USE_NONCONTIGUOUS_BIT (4U) |
Definition at line 1795 of file malloc.c.
Referenced by init_mparams().
typedef struct malloc_chunk mchunk |
typedef struct malloc_chunk* mchunkptr |
typedef struct malloc_segment msegment |
typedef struct malloc_segment* msegmentptr |
typedef struct malloc_state* mstate |
typedef struct malloc_chunk* sbinptr |
typedef struct malloc_tree_chunk* tbinptr |
typedef struct malloc_tree_chunk tchunk |
typedef struct malloc_tree_chunk* tchunkptr |
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().
|
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().
Definition at line 4476 of file malloc.c.
References CALL_MUNMAP, chunk_minus_offset, chunk_plus_offset, chunksize, cinuse, CORRUPTION_ERROR_ACTION, malloc_state::dv, malloc_state::dvsize, malloc_state::footprint, malloc_chunk::head, insert_chunk, INUSE_BITS, is_mmapped, MMAP_FOOT_PAD, ok_address, pinuse, PINUSE_BIT, malloc_chunk::prev_foot, RTCHECK, set_free_with_pinuse, set_size_and_pinuse_of_free_chunk, malloc_state::top, malloc_state::topsize, and unlink_chunk.
Referenced by internal_bulk_free(), internal_memalign(), and try_realloc_chunk().
DLMALLOC_EXPORT size_t dlbulk_free | ( | void ** | , |
size_t | n_elements ) |
References DLMALLOC_EXPORT.
size_t dlbulk_free | ( | void * | array[], |
size_t | nelem ) |
Definition at line 5428 of file malloc.c.
References gm, and internal_bulk_free().
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.
void dlfree | ( | void * | mem | ) |
Definition at line 4788 of file malloc.c.
References CALL_MUNMAP, check_free_chunk, check_inuse_chunk, chunk_minus_offset, chunk_plus_offset, chunksize, cinuse, fm, malloc_chunk::head, insert_large_chunk, insert_small_chunk, INUSE_BITS, is_mmapped, is_small, mem2chunk, MMAP_FOOT_PAD, ok_address, ok_inuse, ok_magic, ok_next, ok_pinuse, pinuse, PINUSE_BIT, POSTACTION, PREACTION, malloc_chunk::prev_foot, release_unused_segments(), RTCHECK, set_free_with_pinuse, set_size_and_pinuse_of_free_chunk, should_trim, sys_trim(), unlink_chunk, and USAGE_ERROR_ACTION.
void ** dlindependent_calloc | ( | size_t | n_elements, |
size_t | elem_size, | ||
void * | chunks[] ) |
DLMALLOC_EXPORT void ** dlindependent_calloc | ( | size_t | , |
size_t | , | ||
void ** | ) |
References DLMALLOC_EXPORT.
void ** dlindependent_comalloc | ( | size_t | n_elements, |
size_t | sizes[], | ||
void * | chunks[] ) |
DLMALLOC_EXPORT void ** dlindependent_comalloc | ( | size_t | , |
size_t * | , | ||
void ** | ) |
References DLMALLOC_EXPORT.
void * dlmalloc | ( | size_t | bytes | ) |
Definition at line 4657 of file malloc.c.
References assert, check_malloced_chunk, check_top_chunk, chunk2mem, chunk_plus_offset, chunksize, compute_bit2idx, ensure_initialization, malloc_chunk::fd, gm, malloc_chunk::head, idx2bit, least_bit, left_bits, MAX_REQUEST, MAX_SIZE_T, MAX_SMALL_REQUEST, MIN_CHUNK_SIZE, MIN_REQUEST, pad_request, PINUSE_BIT, POSTACTION, PREACTION, replace_dv, set_inuse_and_pinuse, set_size_and_pinuse_of_free_chunk, set_size_and_pinuse_of_inuse_chunk, SIZE_T_SIZE, small_index, small_index2size, smallbin_at, sys_alloc(), tmalloc_large(), tmalloc_small(), and unlink_first_small_chunk.
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.
int dlmalloc_trim | ( | size_t | pad | ) |
Definition at line 5449 of file malloc.c.
References ensure_initialization, gm, POSTACTION, PREACTION, and sys_trim().
size_t dlmalloc_usable_size | ( | void * | mem | ) |
int dlmallopt | ( | int | param_number, |
int | value ) |
Definition at line 5507 of file malloc.c.
References change_mparam().
void * dlmemalign | ( | size_t | alignment, |
size_t | bytes ) |
Definition at line 5363 of file malloc.c.
References dlmalloc, gm, internal_memalign(), and MALLOC_ALIGNMENT.
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.
void * dlpvalloc | ( | size_t | bytes | ) |
Definition at line 5405 of file malloc.c.
References dlmemalign, ensure_initialization, mparams, and SIZE_T_ONE.
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.
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.
void * dlvalloc | ( | size_t | bytes | ) |
Definition at line 5396 of file malloc.c.
References dlmemalign, ensure_initialization, and mparams.
|
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().
|
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().
|
static |
Definition at line 4013 of file malloc.c.
References malloc_chunk::bk, malloc_chunk::fd, NSMALLBINS, and smallbin_at.
Referenced by sys_alloc().
|
static |
Definition at line 3160 of file malloc.c.
References ABORT, ACQUIRE_MALLOC_GLOBAL_LOCK, DEFAULT_GRANULARITY, DEFAULT_MMAP_THRESHOLD, DEFAULT_TRIM_THRESHOLD, fd, gm, INITIAL_LOCK, malloc_state::magic, MALLOC_ALIGNMENT, malloc_getpagesize, MAX_SIZE_T, MCHUNK_SIZE, MIN_CHUNK_SIZE, mparams, RELEASE_MALLOC_GLOBAL_LOCK, SIZE_T_ONE, USE_LOCK_BIT, USE_MMAP_BIT, and USE_NONCONTIGUOUS_BIT.
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().
|
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().
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().
|
static |
Definition at line 3614 of file malloc.c.
References align_as_chunk, malloc_segment::base, check_malloc_state, chunksize, ensure_initialization, FENCEPOST_HEAD, malloc_state::footprint, malloc_chunk::head, is_initialized, is_inuse, malloc_state::max_footprint, malloc_segment::next, next_chunk, POSTACTION, PREACTION, malloc_state::seg, segment_holds, malloc_state::top, TOP_FOOT_SIZE, and malloc_state::topsize.
|
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().
|
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().
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().
|
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().
|
static |
Definition at line 4358 of file malloc.c.
References align_as_chunk, assert, malloc_segment::base, CALL_MUNMAP, chunksize, malloc_state::dv, malloc_state::dvsize, malloc_state::footprint, insert_large_chunk, is_extern_segment, is_inuse, is_mmapped_segment, MAX_RELEASE_CHECK_RATE, malloc_segment::next, NO_SEGMENT_TRAVERSAL, malloc_state::release_checks, malloc_state::seg, segment_holds, malloc_segment::size, TOP_FOOT_SIZE, and unlink_large_chunk.
Referenced by dlfree(), and sys_trim().
|
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().
|
static |
Definition at line 4145 of file malloc.c.
References ACQUIRE_MALLOC_GLOBAL_LOCK, add_segment(), malloc_segment::base, CALL_MMAP, CALL_MORECORE, check_malloced_chunk, check_top_chunk, chunk2mem, chunk_plus_offset, CMFAIL, disable_contiguous, ensure_initialization, malloc_state::footprint, malloc_state::footprint_limit, granularity_align, HALF_MAX_SIZE_T, HAVE_MMAP, HAVE_MORECORE, malloc_chunk::head, init_bins(), init_top(), is_extern_segment, is_global, is_initialized, is_page_aligned, malloc_state::least_addr, malloc_state::magic, MALLOC_FAILURE_ACTION, malloc_state::max_footprint, MAX_RELEASE_CHECK_RATE, mem2chunk, mmap_alloc(), MORECORE_CONTIGUOUS, mparams, malloc_segment::next, next_chunk, NO_SEGMENT_TRAVERSAL, page_align, PINUSE_BIT, prepend_alloc(), malloc_state::release_checks, RELEASE_MALLOC_GLOBAL_LOCK, malloc_state::seg, segment_holding(), segment_holds, set_size_and_pinuse_of_inuse_chunk, malloc_segment::sflags, malloc_segment::size, SYS_ALLOC_PADDING, malloc_state::top, TOP_FOOT_SIZE, malloc_state::topsize, use_mmap, USE_MMAP_BIT, and use_noncontiguous.
Referenced by dlmalloc().
|
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().
|
static |
Definition at line 4543 of file malloc.c.
References assert, malloc_tree_chunk::child, chunk2mem, chunk_plus_offset, chunksize, compute_bit2idx, compute_tree_index, CORRUPTION_ERROR_ACTION, malloc_state::dvsize, idx2bit, insert_chunk, least_bit, left_bits, leftmost_child, leftshift_for_tree_index, MIN_CHUNK_SIZE, ok_address, ok_next, RTCHECK, set_inuse_and_pinuse, set_size_and_pinuse_of_free_chunk, set_size_and_pinuse_of_inuse_chunk, SIZE_T_BITSIZE, SIZE_T_ONE, treebin_at, malloc_state::treemap, and unlink_large_chunk.
Referenced by dlmalloc().
|
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().
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().
|
static |
|
static |
Definition at line 2676 of file malloc.c.
Referenced by change_mparam(), dlpvalloc(), dlvalloc(), init_mparams(), init_top(), mmap_resize(), sys_alloc(), and sys_trim().