diff --git a/code/nel/src/3d/animation.cpp b/code/nel/src/3d/animation.cpp index a604d2bde..b33f337d2 100644 --- a/code/nel/src/3d/animation.cpp +++ b/code/nel/src/3d/animation.cpp @@ -30,6 +30,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/3d/animation_optimizer.cpp b/code/nel/src/3d/animation_optimizer.cpp index 726086f8b..9205fde39 100644 --- a/code/nel/src/3d/animation_optimizer.cpp +++ b/code/nel/src/3d/animation_optimizer.cpp @@ -29,6 +29,9 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/3d/cloud.cpp b/code/nel/src/3d/cloud.cpp index eb53589ce..bfd83ba80 100644 --- a/code/nel/src/3d/cloud.cpp +++ b/code/nel/src/3d/cloud.cpp @@ -25,6 +25,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { diff --git a/code/nel/src/3d/driver/direct3d/stddirect3d.h b/code/nel/src/3d/driver/direct3d/stddirect3d.h index c7b6f7f3e..366627b44 100644 --- a/code/nel/src/3d/driver/direct3d/stddirect3d.h +++ b/code/nel/src/3d/driver/direct3d/stddirect3d.h @@ -14,15 +14,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// 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 +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #endif // System includes @@ -42,16 +41,14 @@ #include #include +// Default NeL includes +#include "nel/misc/types_nl.h" #ifdef NL_DEBUG // add Direct3D debug infos #define D3D_DEBUG_INFO #endif -// Directx includes -#include -#include - // 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 +#endif + +// Directx includes +#include +#include + +#endif diff --git a/code/nel/src/sound/driver/xaudio2/stdxaudio2.h b/code/nel/src/sound/driver/xaudio2/stdxaudio2.h index 76b2a13d8..f6e55d0aa 100644 --- a/code/nel/src/sound/driver/xaudio2/stdxaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/stdxaudio2.h @@ -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 + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif // STL includes #include @@ -27,6 +32,8 @@ #include #include +#include "nel/misc/types_nl.h" + // 3rd Party Includes #include #define XAUDIO2_HELPER_FUNCTIONS diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index f2eaf64c0..f262a74af 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -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;