docs: rebuild Memory API content
This commit is contained in:
@@ -1,30 +1,31 @@
|
||||
# PoolAllocator::GetAllocationCount
|
||||
|
||||
获取相关状态或对象。
|
||||
查询当前已分配 block 数量。
|
||||
|
||||
```cpp
|
||||
size_t GetAllocationCount() const override;
|
||||
```
|
||||
|
||||
该方法声明于 `XCEngine/Memory/PoolAllocator.h`,当前页面用于固定 `PoolAllocator` 类目录下的方法级 canonical 路径。
|
||||
## 行为说明
|
||||
|
||||
**参数:** 无。
|
||||
|
||||
**返回:** `size_t` - 返回值语义详见头文件声明。
|
||||
|
||||
**示例:**
|
||||
当前头文件内联实现返回:
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Memory/PoolAllocator.h>
|
||||
|
||||
void Example() {
|
||||
XCEngine::Memory::PoolAllocator object;
|
||||
// 根据上下文补齐参数后调用 PoolAllocator::GetAllocationCount(...)。
|
||||
(void)object;
|
||||
}
|
||||
m_totalBlocks - m_freeBlocks
|
||||
```
|
||||
|
||||
这反映的是“当前在用 block 数”,不是累计分配次数。
|
||||
|
||||
## 返回值
|
||||
|
||||
- `size_t` - 当前在用 block 数。
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 这个值依赖 [Free](Free.md) 正确维护 `m_freeBlocks`。
|
||||
- 如果发生重复释放或错误释放,`m_freeBlocks` 可能超过 `m_totalBlocks`,此处会出现无符号下溢并返回失真的大数值。
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类总览](PoolAllocator.md)
|
||||
- [返回模块目录](../Memory.md)
|
||||
- [返回类型总览](PoolAllocator.md)
|
||||
- [GetFreeBlockCount](GetFreeBlockCount.md)
|
||||
|
||||
Reference in New Issue
Block a user