Delegate memory leak detection to CRT
_CrtDumpMemoryLeaks() direct call misreports heap allocations owned by globally initialized objects. Using _CRTDBG_LEAK_CHECK_DF delays the memory leak check until after globally initialized objects are destroyed. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
@@ -84,7 +84,8 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
UNREFERENCED_PARAMETER(nCmdShow);
|
||||
|
||||
_CrtSetDbgFlag(_crtDbgFlag | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_CHECK_CRT_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
|
||||
int res = MsiUseFeature();
|
||||
assert(!_CrtDumpMemoryLeaks());
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user