mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[TASKMGR] Report any memory leaks on exit (#5340)
Use the power of CRT debug to detect memory leaks. - Define _CRTDBG_MAP_ALLOC and include <crtdbg.h> after <stdlib.h>. - Call _CrtSetDbgFlag at prologue of wWinMain. CORE-18014
This commit is contained in:
parent
ec93c2340d
commit
2441e86963
2 changed files with 10 additions and 0 deletions
|
@ -9,6 +9,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
|
||||
#include <windef.h>
|
||||
|
|
|
@ -116,6 +116,11 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
TOKEN_PRIVILEGES tkp;
|
||||
HANDLE hMutex;
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Report any memory leaks on exit
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
#endif
|
||||
|
||||
/* check wether we're already running or not */
|
||||
hMutex = CreateMutexW(NULL, TRUE, L"taskmgrros");
|
||||
if (hMutex && GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
|
|
Loading…
Reference in a new issue