Files
XCEngine/docs/api/memory/linear-allocator/get-allocation-count.md

31 lines
621 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LinearAllocator::GetAllocationCount
```cpp
size_t GetAllocationCount() const override;
```
返回自分配器创建以来的累计分配次数。线性分配器不支持单个块释放,始终返回 0。
**参数:**
**返回:** 始终返回 `0`
**复杂度:** O(1)
**示例:**
```cpp
#include <XCEngine/Memory/LinearAllocator.h>
LinearAllocator allocator(1024);
allocator.Allocate(256);
allocator.Allocate(128);
allocator.Allocate(64);
size_t count = allocator.GetAllocationCount(); // 0不支持计数
```
## 相关文档
- [LinearAllocator 总览](linear-allocator.md) - 返回类总览