# LinearAllocator::Constructor 构造一个固定容量的线性分配器。 ```cpp explicit LinearAllocator(size_t size, IAllocator* parent = nullptr); ``` ## 行为说明 当前实现会保存总容量和父分配器指针,然后申请底层缓冲区: - 如果 `parent` 非空,通过父分配器申请 `size` 字节。 - 如果 `parent` 为空,当前实现直接调用 `_aligned_malloc(size, 8)`。 这意味着“无父分配器”路径当前是明显的 Windows 风格实现。 ## 参数 - `size` - 缓冲区容量。 - `parent` - 可选的父分配器。 ## 返回值 - 无。 ## 相关文档 - [返回类型总览](LinearAllocator.md) - [Destructor](Destructor.md)