Fix compile errors in Debug - MemLeak.

Add rpcs3/define_new_memleakdetect.h to save and replace new operator with Visual Studio Memory Leak Detection's operator.
Add rpcs3/restore_new.h to restore new operator to a previous saved state.
This commit is contained in:
Arkaran99 2014-09-07 09:49:25 +02:00
parent ec9740e747
commit 1e60319be2
8 changed files with 1834 additions and 1809 deletions

View File

@ -1,5 +1,7 @@
#include "stdafx.h"
#include "restore_new.h"
#include <wx/msgdlg.h>
#include "define_new_memleakdetect.h"
#include "rMsgBox.h"
#ifndef QT_UI

View File

@ -1,5 +1,7 @@
#include "stdafx.h"
#include "restore_new.h"
#include <wx/image.h>
#include "define_new_memleakdetect.h"
#ifndef _WIN32
#include <dirent.h>

View File

@ -4,7 +4,9 @@
#include "sha1.h"
#include "key_vault.h"
#include "unpkg.h"
#include "restore_new.h"
#include <wx/progdlg.h>
#include "define_new_memleakdetect.h"
#include "Utilities/Log.h"
#include "Utilities/rFile.h"

View File

@ -0,0 +1,6 @@
//Override the new operator to use the memory leak detection from visual studio
//Does not work with placement new
#if defined(MSVC_CRT_MEMLEAK_DETECTION) && defined(_DEBUG) && defined(DBG_NEW)
#pragma push_macro("new")
#define new DBG_NEW
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

5
rpcs3/restore_new.h Normal file
View File

@ -0,0 +1,5 @@
//Restore the new operator if previously saved before overriding
//Allow the use of placement new
#if defined(MSVC_CRT_MEMLEAK_DETECTION) && defined(_DEBUG) && defined(DBG_NEW)
#pragma pop_macro("new")
#endif

View File

@ -10,7 +10,7 @@
#if defined(MSVC_CRT_MEMLEAK_DETECTION) && defined(_DEBUG) && !defined(DBG_NEW)
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#include "define_new_memleakdetect.h"
#endif
// This header should be frontend-agnostic, so don't assume wx includes everything