diff --git a/code/nel/src/3d/animatable.cpp b/code/nel/src/3d/animatable.cpp
index c36df64d6..a40a2a0c8 100644
--- a/code/nel/src/3d/animatable.cpp
+++ b/code/nel/src/3d/animatable.cpp
@@ -19,6 +19,9 @@
#include "nel/3d/animatable.h"
#include "nel/3d/channel_mixer.h"
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
namespace NL3D
{
diff --git a/code/nel/src/3d/animated_lightmap.cpp b/code/nel/src/3d/animated_lightmap.cpp
index 4493168ed..0c3564969 100644
--- a/code/nel/src/3d/animated_lightmap.cpp
+++ b/code/nel/src/3d/animated_lightmap.cpp
@@ -22,6 +22,10 @@
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NL3D
{
diff --git a/code/nel/src/3d/animated_material.cpp b/code/nel/src/3d/animated_material.cpp
index dff998863..8e33a3a9f 100644
--- a/code/nel/src/3d/animated_material.cpp
+++ b/code/nel/src/3d/animated_material.cpp
@@ -21,6 +21,10 @@
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NL3D
{
diff --git a/code/nel/src/3d/animated_morph.cpp b/code/nel/src/3d/animated_morph.cpp
index 040fe1484..fcad597f4 100644
--- a/code/nel/src/3d/animated_morph.cpp
+++ b/code/nel/src/3d/animated_morph.cpp
@@ -21,6 +21,10 @@
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NL3D
{
diff --git a/code/nel/src/3d/animation_playlist.cpp b/code/nel/src/3d/animation_playlist.cpp
index 26e84e1e4..336d8d44b 100644
--- a/code/nel/src/3d/animation_playlist.cpp
+++ b/code/nel/src/3d/animation_playlist.cpp
@@ -22,6 +22,10 @@
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NL3D
{
diff --git a/code/nel/src/3d/animation_set.cpp b/code/nel/src/3d/animation_set.cpp
index 8048bcd0a..5f4f351f6 100644
--- a/code/nel/src/3d/animation_set.cpp
+++ b/code/nel/src/3d/animation_set.cpp
@@ -29,6 +29,10 @@
using namespace std;
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NL3D
{
diff --git a/code/nel/src/3d/async_file_manager_3d.cpp b/code/nel/src/3d/async_file_manager_3d.cpp
index 9f94b5260..cbb3f5e5d 100644
--- a/code/nel/src/3d/async_file_manager_3d.cpp
+++ b/code/nel/src/3d/async_file_manager_3d.cpp
@@ -31,6 +31,9 @@
using namespace std;
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
namespace NL3D
{
diff --git a/code/nel/src/3d/vertex_buffer_heap.cpp b/code/nel/src/3d/vertex_buffer_heap.cpp
index 178efc9a8..e33a6757c 100644
--- a/code/nel/src/3d/vertex_buffer_heap.cpp
+++ b/code/nel/src/3d/vertex_buffer_heap.cpp
@@ -21,6 +21,10 @@
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
// This code is not used actually and doesn't compile
// just preproc comment it
#if 0
diff --git a/code/nel/src/ligo/ligo_material.cpp b/code/nel/src/ligo/ligo_material.cpp
index 66212d5aa..2c46e6977 100644
--- a/code/nel/src/ligo/ligo_material.cpp
+++ b/code/nel/src/ligo/ligo_material.cpp
@@ -22,6 +22,10 @@
//using namespace NL3D;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NLLIGO
{
diff --git a/code/nel/src/ligo/primitive.cpp b/code/nel/src/ligo/primitive.cpp
index c94c1609e..6e995eafc 100644
--- a/code/nel/src/ligo/primitive.cpp
+++ b/code/nel/src/ligo/primitive.cpp
@@ -28,6 +28,10 @@ using namespace std;
const uint32 NLLIGO_PRIMITIVE_VERSION = 1;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NLLIGO
{
diff --git a/code/nel/src/ligo/stdligo.h b/code/nel/src/ligo/stdligo.h
index 85e7a2120..adc3887cf 100644
--- a/code/nel/src/ligo/stdligo.h
+++ b/code/nel/src/ligo/stdligo.h
@@ -14,7 +14,15 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
-#include "nel/misc/types_nl.h"
+#ifndef STDLIGO_H
+#define STDLIGO_H
+
+#if defined(_MSC_VER) && defined(_DEBUG)
+ #define _CRTDBG_MAP_ALLOC
+ #include
+ #include
+ #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
+#endif
#include
#include
@@ -44,6 +52,7 @@
// Include from libxml2
#include
+#include "nel/misc/types_nl.h"
#include "nel/misc/debug.h"
#include "nel/misc/common.h"
#include "nel/misc/fast_mem.h"
@@ -67,3 +76,5 @@
#endif
#include
#endif
+
+#endif
diff --git a/code/nel/src/ligo/transition.cpp b/code/nel/src/ligo/transition.cpp
index 2dfa770d4..2a2e7b813 100644
--- a/code/nel/src/ligo/transition.cpp
+++ b/code/nel/src/ligo/transition.cpp
@@ -22,6 +22,10 @@
#include "nel/ligo/ligo_error.h"
#include "nel/ligo/ligo_material.h"
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NLLIGO
{
diff --git a/code/nel/src/ligo/zone_bank.cpp b/code/nel/src/ligo/zone_bank.cpp
index 095410582..b1c6b73c6 100644
--- a/code/nel/src/ligo/zone_bank.cpp
+++ b/code/nel/src/ligo/zone_bank.cpp
@@ -28,6 +28,9 @@
using namespace std;
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
namespace NLLIGO
{
diff --git a/code/nel/src/ligo/zone_edge.cpp b/code/nel/src/ligo/zone_edge.cpp
index 457812cd9..f34d43cd1 100644
--- a/code/nel/src/ligo/zone_edge.cpp
+++ b/code/nel/src/ligo/zone_edge.cpp
@@ -25,6 +25,10 @@
using namespace NLMISC;
+#ifdef DEBUG_NEW
+#define new DEBUG_NEW
+#endif
+
namespace NLLIGO
{
diff --git a/code/nel/src/logic/stdlogic.h b/code/nel/src/logic/stdlogic.h
index 67c7231c1..cdfe3f6f7 100644
--- a/code/nel/src/logic/stdlogic.h
+++ b/code/nel/src/logic/stdlogic.h
@@ -14,8 +14,15 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
-#ifndef NL_STDMISC_H
-#define NL_STDMISC_H
+#ifndef NL_STDLOGIC_H
+#define NL_STDLOGIC_H
+
+#if defined(_MSC_VER) && defined(_DEBUG)
+ #define _CRTDBG_MAP_ALLOC
+ #include
+ #include
+ #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
+#endif
#include
#include