Files
XCEngine/docs/api/XCEngine/Memory/Allocator/GetAllocationCount.md

24 lines
477 B
Markdown
Raw Normal View History

2026-03-26 16:45:24 +08:00
# IAllocator::GetAllocationCount
2026-03-26 18:02:29 +08:00
查询分配计数。
2026-03-26 16:45:24 +08:00
```cpp
virtual size_t GetAllocationCount() const = 0;
```
2026-03-26 18:02:29 +08:00
## 行为说明
2026-03-26 16:45:24 +08:00
2026-03-26 18:02:29 +08:00
这是纯虚统计接口,但不同实现的口径不同:
2026-03-26 16:45:24 +08:00
2026-03-26 18:02:29 +08:00
- `PoolAllocator` 当前返回已分配 block 数。
- `ProxyAllocator` 当前返回内部统计中的 allocationCount。
- `LinearAllocator` 当前始终返回 `0`
2026-03-26 16:45:24 +08:00
2026-03-26 18:02:29 +08:00
## 返回值
2026-03-26 16:45:24 +08:00
2026-03-26 18:02:29 +08:00
- `size_t` - 实现定义的分配计数。
2026-03-26 16:45:24 +08:00
## 相关文档
2026-03-26 18:02:29 +08:00
- [返回类型总览](Allocator.md)