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

基于 heap5 的内存分配实现。 更多...

#include "xf_heap_internal_config.h"
#include "xf_heap.h"
xf_alloc.h 的引用(Include)关系图:

浏览源代码.

函数

void * xf_heap_malloc (unsigned int size)
 带内存管理的内存申请函数。
 
void xf_heap_free (void *pv)
 带内存管理的内存释放函数。
 
unsigned int xf_heap_region (const xf_heap_region_t *const heap_regions)
 内存注册,需要在使用 xf_heap_malloc 之前注册。
 
unsigned int xf_heap_get_block_size (void *pv)
 获取内存块的实际大小。
 

详细描述

基于 heap5 的内存分配实现。

作者
cangyu (sky.k.nosp@m.irto.nosp@m.@qq.c.nosp@m.om)
注解
xf_heap.c 提供最基础的内存管理部分 API.
版本
0.1
日期
2023-11-15

在文件 xf_alloc.h 中定义.

函数说明

◆ xf_heap_malloc()

void * xf_heap_malloc ( unsigned int  size)

带内存管理的内存申请函数。

参数
size申请内存的大小。
返回
void* 申请内存地址

内存剩余足够,则切割成已使用内存块和更小的空闲内存块, 空闲内存块插入空闲内存块链表

在文件 xf_alloc.c60 行定义.

◆ xf_heap_free()

void xf_heap_free ( void *  pv)

带内存管理的内存释放函数。

参数
pv需要释放的指针地址。

在文件 xf_alloc.c119 行定义.

◆ xf_heap_region()

unsigned int xf_heap_region ( const xf_heap_region_t *const  heap_regions)

内存注册,需要在使用 xf_heap_malloc 之前注册。

参数
heap_regions注册内存的数据信息。
返回
unsigned int 总共可用内存大小

在文件 xf_alloc.c141 行定义.

◆ xf_heap_get_block_size()

unsigned int xf_heap_get_block_size ( void *  pv)

获取内存块的实际大小。

参数
pv内存块指针。
返回
unsigned int 内存块实际占用内存大小

在文件 xf_alloc.c204 行定义.