DevPartner Studio Professional Edition 11 内存泄露检测使用
DevPartner Studio Professional Edition含有静态代码分析、错误检测、性能、覆盖率和内存分析以及性能专家功能,用于 Visual Studio 2012、Visual Studio 2010、Visual Studio 2008 和 Visual Studio 2005。
主页:http://www.borland.com/products/devpartner/read/
下载安装DevPartner Studio Professional Edition 11试用版,记得需要安装Micro Focus License Manager。
在Visual Studio 2008菜单栏上多出了一个"DevPartner"选项,如下图所示:
菜单项功能,简述如下:
Choose this menu or toolbar item | To |
Error detection 错误检测 |
Perform run-time error detection using BoundsChecker technology 执行运行时错误检测使用BoundsChecker技术 |
Coverage Analysis 覆盖分析 |
Perform run-time code coverage analysis 执行运行时代码覆盖率分析 |
Error detection and Coverage Analysis 错误检测和覆盖分析 |
Perform run-time error detection with code coverage analysis 执行运行时错误检测与代码覆盖分析 |
Performance Analysis 性能分析 |
Execute run-time performance analysis 执行运行时的性能分析 |
Memory Analysis 内存分析 |
Execute run-time memory analysis 执行运行时的内存分析 |
Performance Expert 性能专家 |
Execute run-time analysis with Performance Expert 使用性能专家执行运行时分析 |
Perform Code Review 执行代码审查 |
Perform static code analysis 执行静态代码分析 |
Manage Code Review Rules 管理代码审查规则 |
Access code review rules management 访问代码审查规则管理 |
Error Detection Rules 错误检测规则 |
Access error detection rules management, used to filter or suppress detected errors 访问错误检测规则管理,用于滤除或抑制检测到的错误 |
Native C/C++ Instrumentation 本机C/C++规范 |
Perform compile-time instrumentation for: Error detection, Error detection with coverage, Performance or coverage analysis 执行编译时规范: 错误检测,错误覆盖检测,性能或覆盖分析 |
Native C/C++ Instrumentation Manager 本机C/C++规范管理 |
Access the Instrumentation Manager 访问规范管理 |
Correlate 关联 |
Correlate performance or coverage files 关联性能或覆盖文件 |
Merge Coverage Files 合并覆盖文件 |
Merge coverage analysis sessions 将覆盖分析会话合并 |
Options 选项 |
Access DevPartner options Choices include: Analysis, Code review, Error Detection 访问DevPartner的选项 选项包括:分析,代码审查,错误检测 |
现在,测试内存泄露检测:
1.准备一个测试工程,这里为Win32控制台程序;
2.菜单"DevPartner"→"Start with Error Detection",可以看到解决方案下,自动添加了一个"DevPartner Studio"项,右侧包含内存泄露、检测到的错误数等等,如下图:
3.现在在测试代码中,加入测试语句:
1
2 3 4 5 |
int _tmain(int argc, _TCHAR* argv[])
{ char *p = new char[100]; return 0; } |
4.再次"Start with Error Detection",程序结束后,可以看到报告了内存泄露,如下图:
在"内存泄露"面板,展开详细,可以看到如下内容:
指示了内存泄露的分配位置,选中这一行,可以看到详细的调用堆栈和源代码,如下图所示:
5.右键此行,选择"Edit Source",可以直接进入源文件,定位到所在行,方便修改。
下载地址:
1.DevPartner Studio Professional Edition 11.0.114.0 http://download.csdn.net/detail/akof1314/4925467http://download.csdn.net/detail/akof1314/4925600
2.DevPartner for Visual C++ BoundsChecker Suite 11.0.114.0 http://download.csdn.net/detail/akof1314/4925726http://download.csdn.net/detail/akof1314/4925780
3.DevPartner License Manager 10 http://download.csdn.net/detail/akof1314/4927248
转自: http://blog.csdn.net/akof1314/article/details/8434499
--------------------- 本文来自 duanbeibei 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/duanbeibei/article/details/37757461?utm_source=copy