856 B
856 B
MemoryManager::CreatePoolAllocator
创建一个池分配器。
std::unique_ptr<PoolAllocator> CreatePoolAllocator(size_t blockSize, size_t count);
行为说明
当前实现等价于:
return std::make_unique<PoolAllocator>(blockSize, count);
它不会使用 m_systemAllocator,因此即使没有调用 Initialize 也可以工作。
参数
blockSize- 单个逻辑 block 大小。count- block 数量。
返回值
std::unique_ptr<PoolAllocator>- 由调用方拥有的池分配器。
注意事项
- 这个工厂同样只是创建对象,不会集中托管其生命周期。
- 参数不会在
MemoryManager层做额外校验,PoolAllocator自身当前也缺少防御式检查。