38 lines
823 B
Markdown
38 lines
823 B
Markdown
|
|
# MemoryManager::GenerateMemoryReport
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
void GenerateMemoryReport();
|
||
|
|
```
|
||
|
|
|
||
|
|
生成并输出当前内存使用情况的详细报告。报告内容包括各分配器的统计信息、峰值使用量、分配次数等。应在启用内存跟踪后调用。
|
||
|
|
|
||
|
|
**参数:** 无
|
||
|
|
|
||
|
|
**返回:** 无
|
||
|
|
|
||
|
|
**复杂度:** O(n)
|
||
|
|
|
||
|
|
**示例:**
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
#include <XCEngine/Memory/MemoryManager.h>
|
||
|
|
|
||
|
|
MemoryManager::Get().Initialize();
|
||
|
|
|
||
|
|
auto proxy = MemoryManager::Get().CreateProxyAllocator("GameFrame");
|
||
|
|
proxy->Allocate(1024 * 1024);
|
||
|
|
proxy->Allocate(512 * 1024);
|
||
|
|
|
||
|
|
// 生成内存报告
|
||
|
|
MemoryManager::Get().GenerateMemoryReport();
|
||
|
|
|
||
|
|
proxy->Free(proxy->Allocate(256 * 1024));
|
||
|
|
MemoryManager::Get().GenerateMemoryReport();
|
||
|
|
|
||
|
|
MemoryManager::Get().Shutdown();
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [MemoryManager 总览](memorymanager.md) - 返回类总览
|