XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_heap.h
浏览该文件的文档.
1
11#ifndef __XF_HEAP_H__
12#define __XF_HEAP_H__
13
45/* ==================== [Includes] ========================================== */
46
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/* ==================== [Defines] =========================================== */
54
55/* ==================== [Typedefs] =========================================== */
56
67typedef struct _xf_heap_region_t {
68 unsigned char *stat_address;
69 unsigned int size_in_bytes;
71
75typedef struct _xf_alloc_func_t {
76 void *(*malloc)(unsigned int size);
77 void (*free)(void *pv);
78 unsigned int (*init)(const xf_heap_region_t *const regions);
79 unsigned int (*get_block_size)(void *pv);
81
82typedef void *(*xf_malloc_t)(unsigned int size);
83typedef void (*xf_free_t)(void *pv);
84typedef unsigned int (*xf_heap_get_free_size_t)(void);
85typedef unsigned int (*xf_heap_get_min_ever_free_size_t)(void);
86
93
94
100/* ==================== [Global Prototypes] ================================= */
101
117void *xf_malloc(unsigned int size);
118
126void xf_free(void *pv);
127
148int xf_heap_api_redirect(const xf_heap_api_t *api);
149
162int xf_heap_init(const xf_heap_region_t *const regions);
163
171int xf_heap_uninit(void);
172
190unsigned int xf_heap_get_free_size(void);
191
197unsigned int xf_heap_get_min_ever_free_size(void);
198
204/* ==================== [Macros] ============================================ */
205
206#ifdef __cplusplus
207} /* extern "C" */
208#endif
209
210#endif // __XF_HEAP_H__
unsigned int xf_heap_get_min_ever_free_size(void)
获取曾经最小的空闲内存块。
Definition xf_heap.c:133
unsigned int xf_heap_get_free_size(void)
获取内存总空闲大小。
Definition xf_heap.c:125
#define xf_malloc(x)
Definition xf_stdlib.h:38
#define xf_free(x)
Definition xf_stdlib.h:39
内存分配操作集。
Definition xf_heap.h:75
unsigned int(* init)(const xf_heap_region_t *const regions)
Definition xf_heap.h:78
void(* free)(void *pv)
Definition xf_heap.h:77
unsigned int(* get_block_size)(void *pv)
Definition xf_heap.h:79
xf_heap_get_min_ever_free_size_t get_min_ever_free_size
Definition xf_heap.h:91
xf_heap_get_free_size_t get_free_size
Definition xf_heap.h:90
xf_malloc_t malloc
Definition xf_heap.h:88
xf_free_t free
Definition xf_heap.h:89
堆内存块结构体。
Definition xf_heap.h:67
unsigned int size_in_bytes
Definition xf_heap.h:69
unsigned char * stat_address
Definition xf_heap.h:68
unsigned int(* xf_heap_get_free_size_t)(void)
Definition xf_heap.h:84
void *(* xf_malloc_t)(unsigned int size)
Definition xf_heap.h:82
int xf_heap_uninit(void)
内存反初始化。
Definition xf_heap.c:93
struct _xf_heap_api_t xf_heap_api_t
int xf_heap_api_redirect(const xf_heap_api_t *api)
重新定义内存管理接口
Definition xf_heap.c:65
void(* xf_free_t)(void *pv)
Definition xf_heap.h:83
unsigned int(* xf_heap_get_min_ever_free_size_t)(void)
Definition xf_heap.h:85
struct _xf_heap_region_t xf_heap_region_t
堆内存块结构体。
int xf_heap_init(const xf_heap_region_t *const regions)
内存初始化。
Definition xf_heap.c:76
struct _xf_alloc_func_t xf_alloc_func_t
内存分配操作集。