Changed: Memory leaks detection

This commit is contained in:
kervala 2016-12-04 17:00:20 +01:00
parent 56d2a24352
commit 3f67ec3e5d
6 changed files with 45 additions and 13 deletions

View file

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

View file

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

View file

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

View file

@ -14,15 +14,14 @@
// 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/>.
// Default NeL includes
#include "nel/misc/types_nl.h"
#ifndef STDDIRECT3D_H
#define STDDIRECT3D_H
#ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.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
// System includes
@ -42,16 +41,14 @@
#include <deque>
#include <limits>
// Default NeL includes
#include "nel/misc/types_nl.h"
#ifdef NL_DEBUG
// add Direct3D debug infos
#define D3D_DEBUG_INFO
#endif
// Directx includes
#include <d3d9.h>
#include <d3dx9math.h>
// NeL includes
#include "nel/misc/common.h"
#include "nel/misc/debug.h"
@ -59,3 +56,17 @@
#include "nel/misc/mem_stream.h"
#include "nel/misc/time_nl.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
#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
#include <iostream>
@ -27,6 +32,8 @@
#include <limits>
#include <intrin.h>
#include "nel/misc/types_nl.h"
// 3rd Party Includes
#include <basetyps.h>
#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)
#endif
{
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
// init the Nel context
CApplicationContext *appContext = new CApplicationContext;