int main(int argc, char* argv[])
{
_CrtSetBreakAlloc(284);
{
boost::filesystem::path p(argv[0]);
std::string b = p.extension().generic_string();;
}
_CrtDumpMemoryLeaks();
return 0;
}
下面是output显示的内容, 分两部分, 一部分是用_CrtDumpMemoryLeaks()显示的两个泄漏点, 这两个点分别是extension()里用到的path, 从内存申请点断点来看, 确实没有释放; 另外我安装了最新版的Visual Leak Detector, 却显示没有泄漏
Visual Leak Detector Version 2.4RC2 installed.
Detected memory leaks!
Dumping objects ->
{296} normal block at 0x0081D8E0, 8 bytes long.
Data: <0 1 > 30 16 31 00 00 00 00 00
{282} normal block at 0x0081BFD0, 8 bytes long.
Data: < 1 > 08 16 31 00 00 00 00 00
Object dump complete.
The thread 0x78 has exited with code 0 (0x0).
The thread 0x2fa4 has exited with code 0 (0x0).
The thread 0x6b0 has exited with code 0 (0x0).
No memory leaks detected.
Visual Leak Detector is now exiting.