视觉泄漏检测器未报告泄漏 [英] Visual Leak Detector not reporting leaks

查看:62
本文介绍了视觉泄漏检测器未报告泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用Visual Studio 2013有点陌生,并试图使Visual Leak Detector(2.3版)正常工作,以便可以检查项目中的内存泄漏.

I am a bit new to using Visual Studio 2013 and am trying to get Visual Leak Detector (Version 2.3) working so that I can check my projects for memory leaks.

我已经安装并添加了它 C:\ Program Files(x86)\ Visual Leak Detector \ include到我的包含目录

I've got it installed and have added C:\Program Files (x86)\Visual Leak Detector\include to my include directories

和C:\ Program Files(x86)\ Visual Leak Detector \ lib \ Win32到我的库目录(均为调试模式).

and C:\Program Files (x86)\Visual Leak Detector\lib\Win32 to my library directories (both for debug mode).

我使用调试菜单(或按f5键)构建并运行以下简单程序:

I build and run the following simple program using the debug menu (or hitting f5):

#include <iostream>
#include <vld.h> //visual leak detector

using namespace std;

int main()
{
for (int i = 0; i < 1000000; i++)
     int *ptr = new int(100);

return 0;
}

在这里,泄漏是显而易见的(并且是故意的),以测试功能,但这是我得到的报告:

The leak is obvious (and intentional) here, to test the functionality, but this is the report I get back:

Visual Leak Detector Version 2.3 installed.
The thread 0x38ac has exited with code 0 (0x0).
No memory leaks detected.
Visual Leak Detector is now exiting.
The program '[8136] Test.exe' has exited with code 0 (0x0).

有什么想法吗?

我应该指出,添加

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

在我的代码开头和

_CrtDumpMemoryLeaks();

就在main()结束之前,实际上确实导致Visual Studio的内置泄漏检测报告了泄漏,但是Visual泄漏检测器仍然遵循此报告,说没有检测到内存泄漏并且不提供任何信息.

right before the end of main(), does in fact cause Visual Studio's built in leak detection to report leaks, however Visual leak detector still follows this report by saying No memory leaks detected and providing no information.

推荐答案

它似乎是VC ++ 2013的一个错误,当我使用VC ++ 2010编译器时它确实可以工作.

It looks like to be a bug with VC++2013, it does work when I use the VC++2010 compiler.

尽管我可以想象这不是您的选择.如果有帮助,您可以使用最新的Beta版本 v2.4rc2 .

Although I can imagine this not being an option for you. If it helps you, you could use the latest beta version v2.4rc2.

这篇关于视觉泄漏检测器未报告泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆