This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 必须遵守的规则 | |
1.1 区分真实泄漏与误报 | |
1.1.1 软件被终止时,静态/全局变量不会被释放 → 不是真实泄漏 | |
1.1.2 必须检查变量作用域和存储持续时间 | |
1.1.3 使用调试符号验证符号类型 | |
1.2 内存分配/释放必须精确配对,举例如下: | |
// 必须遵循的模式 | |
Type* ptr = new Type(); // 分配 | |
delete ptr; // 释放 | |
// 数组要求 |