检测visual studio c+中的内存泄漏+;两行之间 < >我想检测VisualStudioC++中的内存泄漏。但我不想检查整个解决方案,而是想检查两个代码行或函数之间的内存泄漏。我不想在整个解决方案中检查内存泄漏。例如: // some code startMemoryLeakDetection() // other code stopAndReportMemoryLeakDetection() // some other code
有人能给我介绍一下必要的工具/程序吗?您可以使用CRT转储和内存状态比较来识别内存泄漏,以获得统计信息。 有关更多详细信息,请参阅MSDN中给出的步骤检测visual studio c+中的内存泄漏+;两行之间 < >我想检测VisualStudioC++中的内存泄漏。但我不想检查整个解决方案,而是想检查两个代码行或函数之间的内存泄漏。我不想在整个解决方案中检查内存泄漏。例如: // some code startMemoryLeakDetection() // other code stopAndReportMemoryLeakDetection() // some other code,c++,visual-studio-2012,memory-leaks,C++,Visual Studio 2012,Memory Leaks,有人能给我介绍一下必要的工具/程序吗?您可以使用CRT转储和内存状态比较来识别内存泄漏,以获得统计信息。 有关更多详细信息,请参阅MSDN中给出的步骤 _CrtMemCheckpoint( &s1 ); // memory allocations take place here _CrtMemCheckpoint( &s2 ); if ( _CrtMemDifference( &s3, &s1, &s2) ) _CrtMemDumpStatisti
_CrtMemCheckpoint( &s1 );
// memory allocations take place here
_CrtMemCheckpoint( &s2 );
if ( _CrtMemDifference( &s3, &s1, &s2) )
_CrtMemDumpStatistics( &s3 );
如果其他线程正在运行,或者检查点之间的代码命中了单例或其他全局变量,并且改变了它们所持有的堆内存量,请务必小心。这两种情况都可能导致误报。注意:在代码块的开头缺少一个。