- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
35 lines
689 B
Markdown
35 lines
689 B
Markdown
# PoolAllocator::GetTotalBlockCount
|
|
|
|
```cpp
|
|
size_t GetTotalBlockCount() const;
|
|
```
|
|
|
|
返回内存池中的总块数。此值在构造时确定,之后保持不变。
|
|
|
|
**参数:** 无
|
|
|
|
**返回:** 内存池的总块数
|
|
|
|
**复杂度:** O(1)
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
#include <XCEngine/Memory/PoolAllocator.h>
|
|
|
|
PoolAllocator pool(sizeof(int), 100);
|
|
|
|
size_t total = pool.GetTotalBlockCount(); // 100
|
|
size_t free = pool.GetFreeBlockCount(); // 100
|
|
|
|
void* block = pool.Allocate();
|
|
size_t freeAfter = pool.GetFreeBlockCount(); // 99
|
|
|
|
pool.Free(block);
|
|
size_t freeRestored = pool.GetFreeBlockCount(); // 100
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [PoolAllocator 总览](pool-allocator.md) - 返回类总览
|