视觉泄漏检测器未找到泄漏VS2013 [英] Visual Leak Detector not finding leaks VS2013
本文介绍了视觉泄漏检测器未找到泄漏VS2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
无论尝试什么,我似乎都无法使VLD捕获任何内存泄漏.有什么想法吗?
I can't seem to make VLD catch any memory leaks no matter what I tried. Any ideas why ?
这里也是输出的摘录:
Visual Leak Detector Version 2.4RC2 installed.
The thread 0x5748 has exited with code 0 (0x0).
The thread 0x2c70 has exited with code 0 (0x0).
The thread 0x3c98 has exited with code 0 (0x0).
No memory leaks detected.
Visual Leak Detector is now exiting.
The program '[24988] ConsoleApplication2.exe' has exited with code 0 (0x0).
#include <vld.h>
#include <iostream>
using namespace std;
class Car{
public:
Car() {}
Car(string model,int year, string color) {
this->model = model; this->color, this->year = year;
}
string getModel() {
return this->model;
}
void setModel(string m) {
this->model = model;
}
string getColor() {
return this->color;
}
void setColor(string color) {
this->color = color;
}
void paint()
{
setColor("white");
}
private:
string model;
int year;
string color;
};
int _tmain(int argc, _TCHAR* argv[]){
Car c("bmw", 2000, "red");
c.paint();
cout << c.getColor().c_str();
for (int i = 0; i < 10; i++)
int *ptr = new int(10);
Car *c2 = new Car("benz", 2010, "yellow");
return 0;
}
我想念什么?
推荐答案
它正在Visual Studio 2013 Ultimate下工作
It's working under visual studio 2013 ultimate
您必须在控制台模式下执行程序(转到项目的调试目录)
You have to execute the program in a console mode (go to the debug directory of the project)
在下面,您将找到结果的图片,但是控制台显示了很多泄漏,我们在这里看不到所有泄漏
In the following, you will find a picture of the result, but the console displayed many leaks we can't see all of them here
我在项目设置中添加了include和lib路径
I added the include and lib paths to the project setting
- C:\ Program Files(x86)\ Visual Leak Detector \ include
- C:\ Program Files(x86)\ Visual Leak Detector \ lib \ win32
- C:\ Program Files(x86)\ Visual Leak Detector \ lib \ win64
如您所见,内存泄漏13次.
As you see there is 13 memory leaks.
这篇关于视觉泄漏检测器未找到泄漏VS2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文