12#if !defined(_INCLUDE_MM_HEAP_H_)
13#define _INCLUDE_MM_HEAP_H_ 1
86#define mstr_heap_init(mem, leng) ((void)mem, (void)leng)
88#define mstr_heap_alloc(s) _MSTR_MEM_ALLOC_FUNCTION((s))
90#if MSTR_MEM_REALLOC_FUNCTION_NOT_AVAL
95#define mstr_heap_realloc(p, new_s, old_s) \
96 mstr_heap_realloc_cpimp_sym((p), (new_s), (old_s))
102#define mstr_heap_realloc(p, s, os) _MSTR_MEM_REALLOC_FUNCTION((p), (s))
105#define mstr_heap_free(m) \
107 _MSTR_MEM_FREE_FUNCTION(m); \
111#define mstr_heap_init(mem, leng) \
113 mstr_heap_init_sym((iptr_t)(mem), (usize_t)(leng)); \
116#define mstr_heap_alloc(s) (mstr_heap_allocate_sym((s), 4))
118#define mstr_heap_realloc(p, new_s, old_s) \
119 mstr_heap_re_allocate_sym((p), (new_s), (old_s))
121#define mstr_heap_free(m) \
123 mstr_heap_free_sym(m); \
mstr_heap_allocate_sym(usize_t size, usize_t align)
尝试从堆中分配size大小的内存
Definition mm_heap.c:127
mstr_heap_re_allocate_sym(void *old_ptr, usize_t new_size, usize_t old_size)
尝试从堆中重新分配size大小的内存
Definition mm_heap.c:135
mstr_heap_get_allocate_count(usize_t *alloc_count, usize_t *free_count)
取得分配器的统计数据
Definition mm_heap.c:163
MSTR_EXPORT_API(void) mstr_heap_free_sym(void *memory)
释放由 mstr_heap_allocate 分配的内存
Definition mm_heap.c:147
mstr_heap_realloc_cpimp_sym(void *old_ptr, usize_t new_size, usize_t old_size)
由memcpy实现realloc
Definition mm_heap.c:170
mstr_heap_init_sym(iptr_t heap_memory, usize_t heap_size)
初始化堆分配器
Definition mm_heap.c:121
intptr_t iptr_t
Definition mm_type.h:39
size_t usize_t
尺寸(无符号)
Definition mm_type.h:32