diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 2851759de..6431701fe 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -412,8 +412,16 @@ typedef unsigned int uint; // at least 32bits (depend of processor) #define NL_DEFAULT_MEMORY_ALIGNMENT 16 #define NL_ALIGN_SSE2 NL_ALIGN(NL_DEFAULT_MEMORY_ALIGNMENT) -#ifndef NL_CPU_X86_64 +#ifdef NL_CPU_X86_64 // on x86_64, new and delete are already aligned on 16 bytes +#elif (defined(NL_COMP_VC) && defined(NL_DEBUG)) +// don't use aligned memory if debugging with VC++ in 32 bits +#else +// use aligned memory in all other cases +#define NL_USE_ALIGNED_MEMORY_OPERATORS +#endif + +#ifdef NL_USE_ALIGNED_MEMORY_OPERATORS #ifdef NL_NO_EXCEPTION_SPECS extern void *operator new(size_t size); @@ -425,9 +433,9 @@ extern void *operator new(size_t size) throw(std::bad_alloc); extern void *operator new[](size_t size) throw(std::bad_alloc); extern void operator delete(void *p) throw(); extern void operator delete[](void *p) throw(); -#endif +#endif /* NL_NO_EXCEPTION_SPECS */ -#endif +#endif /* NL_USE_ALIGNED_MEMORY_OPERATORS */ #else /* NL_HAS_SSE2 */ diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index db605f4f1..599f3cfb2 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -80,7 +80,7 @@ extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); } #endif // !NL_COMP_MINGW -#if defined(NL_HAS_SSE2) && !defined(NL_CPU_X86_64) +#ifdef NL_USE_ALIGNED_MEMORY_OPERATORS #ifdef NL_NO_EXCEPTION_SPECS void *operator new(size_t size)