hello
I just downloaded the vld lib and test it with the following code:
when i removed the delete completely the detection was ok.
I just downloaded the vld lib and test it with the following code:
class Leak
{
public:
Leak(const std::string& str)
{
c = new char[str.length()]();
memcpy(c, str.c_str(), str.length());
}
void print()
{
std::cout << c << std::endl;
}
~Leak()
{
delete c;
}
private:
char* c;
};
class LeakHolder
{
public:
LeakHolder()
{
leak.reset(new Leak("Hello World!"));
}
private:
std::unique_ptr<Leak> leak;
};
int _tmain(int argc, _TCHAR* argv[])
{
LeakHolder lh;
return 0;
}
this code is leaking the array memory since the delete is deleting only the first char and not the all array, but the library didn't report any memory leak. when i removed the delete completely the detection was ok.