Changed: Memory leaks detection

--HG--
branch : develop
This commit is contained in:
kervala 2016-12-04 17:00:20 +01:00
parent 44c15f946c
commit b6662b9e0b
6 changed files with 45 additions and 13 deletions

View file

@ -30,6 +30,9 @@
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D namespace NL3D
{ {

View file

@ -29,6 +29,9 @@
using namespace NLMISC; using namespace NLMISC;
using namespace std; using namespace std;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D namespace NL3D
{ {

View file

@ -25,6 +25,10 @@
using namespace NLMISC; using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D namespace NL3D
{ {

View file

@ -14,15 +14,14 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// Default NeL includes #ifndef STDDIRECT3D_H
#include "nel/misc/types_nl.h" #define STDDIRECT3D_H
#ifdef NL_OS_WINDOWS #if defined(_MSC_VER) && defined(_DEBUG)
# define WIN32_LEAN_AND_MEAN #define _CRTDBG_MAP_ALLOC
# ifndef NL_COMP_MINGW #include <stdlib.h>
# define NOMINMAX #include <crtdbg.h>
# endif #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
# include <windows.h>
#endif #endif
// System includes // System includes
@ -42,16 +41,14 @@
#include <deque> #include <deque>
#include <limits> #include <limits>
// Default NeL includes
#include "nel/misc/types_nl.h"
#ifdef NL_DEBUG #ifdef NL_DEBUG
// add Direct3D debug infos // add Direct3D debug infos
#define D3D_DEBUG_INFO #define D3D_DEBUG_INFO
#endif #endif
// Directx includes
#include <d3d9.h>
#include <d3dx9math.h>
// NeL includes // NeL includes
#include "nel/misc/common.h" #include "nel/misc/common.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
@ -59,3 +56,17 @@
#include "nel/misc/mem_stream.h" #include "nel/misc/mem_stream.h"
#include "nel/misc/time_nl.h" #include "nel/misc/time_nl.h"
#include "nel/misc/command.h" #include "nel/misc/command.h"
#ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
#endif
// Directx includes
#include <d3d9.h>
#include <d3dx9math.h>
#endif

View file

@ -17,7 +17,12 @@
#ifndef NLSOUND_STDPCH_XAUDIO2_H #ifndef NLSOUND_STDPCH_XAUDIO2_H
#define NLSOUND_STDPCH_XAUDIO2_H #define NLSOUND_STDPCH_XAUDIO2_H
#include "nel/misc/types_nl.h" #if defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
// STL includes // STL includes
#include <iostream> #include <iostream>
@ -27,6 +32,8 @@
#include <limits> #include <limits>
#include <intrin.h> #include <intrin.h>
#include "nel/misc/types_nl.h"
// 3rd Party Includes // 3rd Party Includes
#include <basetyps.h> #include <basetyps.h>
#define XAUDIO2_HELPER_FUNCTIONS #define XAUDIO2_HELPER_FUNCTIONS

View file

@ -143,6 +143,10 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR cm
int main(int argc, char **argv) int main(int argc, char **argv)
#endif #endif
{ {
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
// init the Nel context // init the Nel context
CApplicationContext *appContext = new CApplicationContext; CApplicationContext *appContext = new CApplicationContext;