docs: 更新 API 文档 - 多模块修复和完善
- audio: 更新 audio-system 方法文档 - components: 新增 audio-listener/audio-source 组件方法文档,新增 remove-component 方法 - core: 更新 filewriter, types 文档 - math: 更新 box 方法文档 - memory: 更新 proxy-allocator 文档 - resources: 更新 loader 和 texture 文档 - rhi: 更新 opengl 设备、shader、swap-chain 文档 - threading: 更新 mutex 和 task-system 文档
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`ProxyAllocator`](constructor.md) | 构造代理分配器 |
|
||||
| [`~ProxyAllocator`](~proxy-allocator.md) | 析构函数 |
|
||||
| [`Allocate`](allocate.md) | 分配内存并记录统计 |
|
||||
| [`Free`](free.md) | 释放内存并记录统计 |
|
||||
| [`Reallocate`](reallocate.md) | 转发到底层分配器 |
|
||||
@@ -26,39 +28,6 @@
|
||||
| [`GetAllocationCount`](get-allocation-count.md) | 获取分配次数 |
|
||||
| [`GetName`](get-name.md) | 获取分配器名称 |
|
||||
|
||||
## 构造函数
|
||||
|
||||
```cpp
|
||||
ProxyAllocator(IAllocator* underlying, const char* name);
|
||||
```
|
||||
|
||||
构造一个代理分配器,包装底层分配器并记录分配统计。所有 `Allocate`、`Free`、`Reallocate` 调用都会被转发到底层分配器,同时记录统计信息。名称用于日志和报告。
|
||||
|
||||
**参数:**
|
||||
- `underlying` - 被包装的底层分配器,不能为 `nullptr`
|
||||
- `name` - 代理分配器的名称字符串
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Memory/MemoryManager.h>
|
||||
#include <XCEngine/Memory/ProxyAllocator.h>
|
||||
|
||||
MemoryManager::Get().Initialize();
|
||||
|
||||
// 使用系统分配器作为底层
|
||||
IAllocator* sysAlloc = MemoryManager::Get().GetSystemAllocator();
|
||||
ProxyAllocator proxy(sysAlloc, "TempAllocations");
|
||||
|
||||
// 通过代理分配
|
||||
void* ptr = proxy.Allocate(1024);
|
||||
proxy.Free(ptr);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Memory 模块总览](../memory.md) - 返回模块总览
|
||||
|
||||
Reference in New Issue
Block a user