Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/157.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检测visual studio c+中的内存泄漏+;两行之间 < >我想检测VisualStudioC++中的内存泄漏。但我不想检查整个解决方案,而是想检查两个代码行或函数之间的内存泄漏。我不想在整个解决方案中检查内存泄漏。例如: // some code startMemoryLeakDetection() // other code stopAndReportMemoryLeakDetection() // some other code_C++_Visual Studio 2012_Memory Leaks - Fatal编程技术网

检测visual studio c+中的内存泄漏+;两行之间 < >我想检测VisualStudioC++中的内存泄漏。但我不想检查整个解决方案,而是想检查两个代码行或函数之间的内存泄漏。我不想在整个解决方案中检查内存泄漏。例如: // some code startMemoryLeakDetection() // other code stopAndReportMemoryLeakDetection() // some other code

检测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

有人能给我介绍一下必要的工具/程序吗?

您可以使用CRT转储和内存状态比较来识别内存泄漏,以获得统计信息。 有关更多详细信息,请参阅MSDN中给出的步骤

_CrtMemCheckpoint( &s1 );
// memory allocations take place here
_CrtMemCheckpoint( &s2 );

if ( _CrtMemDifference( &s3, &s1, &s2) )
   _CrtMemDumpStatistics( &s3 );

如果其他线程正在运行,或者检查点之间的代码命中了单例或其他全局变量,并且改变了它们所持有的堆内存量,请务必小心。这两种情况都可能导致误报。注意:在代码块的开头缺少一个。