|
XWOS API
4.0
XWOS C/C++ API参考手册
|
XWOS内存管理:内存池:页分配器 更多...
#include <xwos/standard.h>#include <xwos/lib/rbtree.h>#include <xwos/lib/bclst.h>#include <xwos/lib/xwbop.h>#include <xwos/osal/lock/seqlock.h>#include <xwos/mm/common.h>#include <xwos/mm/mempool/i_allocator.h>#include <xwos/mm/mempool/page.h>
宏定义 | |
| #define | xwmm_mempoollogf(lv, thd, fmt, ...) |
XWOS内存管理:内存池:页分配器
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
在文件 page.c 中定义.
|
static |
|
static |
合并空闲的伙伴页
| [in] | pa | 页分配器的指针 |
| [in] | pg | 页控制块的指针 |


|
static |
将大的页拆分成小的页
| [in] | pa | 页分配器的指针 |
| [in] | pg | 被拆分的页控制块的指针 |
| [in] | target_odr | 目标页数量的阶 |
| [in] | ot | 被拆分的页所在的阶红黑树的指针 |


|
static |
|
static |
|
static |
i_allocator接口函数:释放内存
| [in] | this | this指针(页分配器) |
| [in] | mem | 内存的首地址 |
| XWOK | 没有错误 |
| -ENOMEM | 内存不足 |
<No error


i_allocator接口函数:申请内存
| [in] | this | this指针(页分配器) |
| [in] | size | 申请的大小 |
| [out] | membuf | 指向缓冲区的指针,通过此缓冲区返回申请到的内存的首地址 |
| XWOK | 没有错误 |
| -ENOMEM | 内存不足 |
<No error


|
static |
增加页到阶红黑树中
| [in] | ot | 阶红黑树的指针 |
| [in] | pg | 页控制块的指针 |
| XWOK | 没有错误 |
| -EEXIST | 页已在阶红黑树中 |
< 报告BUG
<No error


|
static |
从阶红黑树中选择一页
| [in] | ot | 阶红黑树的指针 |


|
static |
从阶红黑树中删除页
| [in] | ot | 阶红黑树的指针 |
| [in] | pg | 页控制块的指针 |
| XWOK | 没有错误 |
| -ESRCH | 页不在阶红黑树中 |
| -EBUSY | 页不在阶红黑树中 |
<No error

