XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_heap.h 文件参考

堆内存接口。 更多...

xf_heap.h 的引用(Include)关系图:

浏览源代码.

结构体

struct  _xf_heap_region_t
 堆内存块结构体。 更多...
 
struct  _xf_alloc_func_t
 内存分配操作集。 更多...
 
struct  _xf_heap_api_t
 

类型定义

typedef struct _xf_heap_region_t xf_heap_region_t
 堆内存块结构体。
 
typedef struct _xf_alloc_func_t xf_alloc_func_t
 内存分配操作集。
 
typedef void *(* xf_malloc_t) (unsigned int size)
 
typedef void(* xf_free_t) (void *pv)
 
typedef unsigned int(* xf_heap_get_free_size_t) (void)
 
typedef unsigned int(* xf_heap_get_min_ever_free_size_t) (void)
 
typedef struct _xf_heap_api_t xf_heap_api_t
 

函数

void * xf_malloc (unsigned int size)
 申请内存。
 
void xf_free (void *pv)
 释放内存。
 
unsigned int xf_heap_get_free_size (void)
 获取内存总空闲大小。
 
unsigned int xf_heap_get_min_ever_free_size (void)
 获取曾经最小的空闲内存块。
 
int xf_heap_api_redirect (const xf_heap_api_t *api)
 重新定义内存管理接口
 
int xf_heap_init (const xf_heap_region_t *const regions)
 内存初始化。
 
int xf_heap_uninit (void)
 内存反初始化。
 

详细描述

堆内存接口。

作者
cangyu (sky.k.nosp@m.irto.nosp@m.@qq.c.nosp@m.om)
版本
0.1
日期
2023-11-14

在文件 xf_heap.h 中定义.

类型定义说明

◆ xf_heap_region_t

堆内存块结构体。

◆ xf_alloc_func_t

内存分配操作集。

◆ xf_malloc_t

typedef void *(* xf_malloc_t) (unsigned int size)

在文件 xf_heap.h82 行定义.

◆ xf_free_t

typedef void(* xf_free_t) (void *pv)

在文件 xf_heap.h83 行定义.

◆ xf_heap_get_free_size_t

typedef unsigned int(* xf_heap_get_free_size_t) (void)

在文件 xf_heap.h84 行定义.

◆ xf_heap_get_min_ever_free_size_t

typedef unsigned int(* xf_heap_get_min_ever_free_size_t) (void)

在文件 xf_heap.h85 行定义.

◆ xf_heap_api_t

typedef struct _xf_heap_api_t xf_heap_api_t

函数说明

◆ xf_heap_api_redirect()

int xf_heap_api_redirect ( const xf_heap_api_t api)

重新定义内存管理接口

参数
api内存管理接口
返回
int
  • XF_HEAP_FAIL 参数定义错误
  • XF_HEAP_OK 设置成功

在文件 xf_heap.c65 行定义.

◆ xf_heap_init()

int xf_heap_init ( const xf_heap_region_t *const  regions)

内存初始化。

参数
regions注册不同内存区域。
注解
regions 数组最后一个元素必须是 {}(0数组)。内部以此作为数组结束标志。
该函数只能在 xf_malloc 之前调用。
返回
int
  • 0 设置成功
  • -1 设置失败

在文件 xf_heap.c76 行定义.

◆ xf_heap_uninit()

int xf_heap_uninit ( void  )

内存反初始化。

返回
int
  • 0 设置成功
  • -1 设置失败

在文件 xf_heap.c93 行定义.