mirror of https://github.com/AxioDL/tinyxml2.git
Merge pull request #562 from Dmitry-Me/testMemoryLeaksInDebugHeap
Programmatically check no leaks are reported in the VC++ debug heap
This commit is contained in:
commit
5cfb946953
|
@ -292,6 +292,10 @@ int main( int argc, const char ** argv )
|
||||||
_CrtMemCheckpoint( &startMemState );
|
_CrtMemCheckpoint( &startMemState );
|
||||||
// Enable MS Visual C++ debug heap memory leaks dump on exit
|
// Enable MS Visual C++ debug heap memory leaks dump on exit
|
||||||
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
|
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
|
||||||
|
{
|
||||||
|
int leaksOnStart = _CrtDumpMemoryLeaks();
|
||||||
|
XMLTest( "No leaks on start?", FALSE, leaksOnStart );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1854,6 +1858,11 @@ int main( int argc, const char ** argv )
|
||||||
_CrtMemState diffMemState;
|
_CrtMemState diffMemState;
|
||||||
_CrtMemDifference( &diffMemState, &startMemState, &endMemState );
|
_CrtMemDifference( &diffMemState, &startMemState, &endMemState );
|
||||||
_CrtMemDumpStatistics( &diffMemState );
|
_CrtMemDumpStatistics( &diffMemState );
|
||||||
|
|
||||||
|
{
|
||||||
|
int leaksBeforeExit = _CrtDumpMemoryLeaks();
|
||||||
|
XMLTest( "No leaks before exit?", FALSE, leaksBeforeExit );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf ("\nPass %d, Fail %d\n", gPass, gFail);
|
printf ("\nPass %d, Fail %d\n", gPass, gFail);
|
||||||
|
|
Loading…
Reference in New Issue