32 lines
636 B
Markdown
32 lines
636 B
Markdown
|
|
# MemoryManager::DumpMemoryLeaks
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
void DumpMemoryLeaks();
|
||
|
|
```
|
||
|
|
|
||
|
|
输出当前未释放的内存分配信息。如果启用了内存跟踪,此方法会遍历所有记录并报告疑似泄漏的分配。应在程序退出前调用,以便发现资源泄漏。
|
||
|
|
|
||
|
|
**参数:** 无
|
||
|
|
|
||
|
|
**返回:** 无
|
||
|
|
|
||
|
|
**复杂度:** O(n)
|
||
|
|
|
||
|
|
**示例:**
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
#include <XCEngine/Memory/MemoryManager.h>
|
||
|
|
|
||
|
|
MemoryManager::Get().Initialize();
|
||
|
|
|
||
|
|
// ... 程序运行 ...
|
||
|
|
|
||
|
|
// 程序退出前检查泄漏
|
||
|
|
MemoryManager::Get().DumpMemoryLeaks();
|
||
|
|
MemoryManager::Get().Shutdown();
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [MemoryManager 总览](manager.md) - 返回类总览
|