docs: update memory and threading API docs
This commit is contained in:
27
docs/api/memory/memorymanager/getsystemallocator.md
Normal file
27
docs/api/memory/memorymanager/getsystemallocator.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# MemoryManager::GetSystemAllocator
|
||||
|
||||
```cpp
|
||||
IAllocator* GetSystemAllocator();
|
||||
```
|
||||
|
||||
获取系统默认分配器。该分配器使用标准 C 库的 `std::malloc` 和平台特定的对齐分配函数(如 Windows 的 `_aligned_malloc`)作为后端,适用于通用内存分配场景。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 系统分配器指针
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Memory/MemoryManager.h>
|
||||
|
||||
IAllocator* sysAlloc = MemoryManager::Get().GetSystemAllocator();
|
||||
void* ptr = sysAlloc->Allocate(1024);
|
||||
sysAlloc->Free(ptr);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [MemoryManager 总览](memorymanager.md) - 返回类总览
|
||||
Reference in New Issue
Block a user