Files
XCEngine/docs/api/XCEngine/Memory/MemoryManager/Initialize.md

32 lines
667 B
Markdown
Raw Normal View History

2026-03-26 16:45:24 +08:00
# MemoryManager::Initialize
2026-03-26 18:02:29 +08:00
初始化内部系统分配器。
2026-03-26 16:45:24 +08:00
```cpp
void Initialize();
```
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
1. 如果 `m_initialized` 已经是 `true`,直接返回。
2. 否则执行 `m_systemAllocator = new SystemAllocator();`
3.`m_initialized` 设为 `true`
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
- 无。
2026-03-26 16:45:24 +08:00
2026-03-26 18:02:29 +08:00
## 当前实现限制
- 不加锁,不适合并发初始化。
- 不处理 `new SystemAllocator()` 失败后的恢复逻辑。
- 不会因为 `m_trackAllocations` 的值不同而启用额外跟踪流程。
2026-03-26 16:45:24 +08:00
## 相关文档
2026-03-26 18:02:29 +08:00
- [返回类型总览](MemoryManager.md)
- [GetSystemAllocator](GetSystemAllocator.md)
- [Shutdown](Shutdown.md)