22#define COMMON_H
33
44#include < Eigen/Dense>
5+ #include " float.h"
56
67#define USE_DOUBLE
8+ #define MIN_PARALLEL_SIZE 64
79
810#ifdef USE_DOUBLE
911typedef double Real;
@@ -44,6 +46,7 @@ namespace PBD
4446
4547#if EIGEN_ALIGN
4648 #define PDB_MAKE_ALIGNED_OPERATOR_NEW EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49+ #define REPORT_MEMORY_LEAKS
4750
4851#if defined(WIN32) || defined(_WIN32) || defined(WIN64)
4952#ifdef _DEBUG
@@ -57,19 +60,42 @@ namespace PBD
5760 void *operator new [](size_t size, int const block_use, char const * file_name, int const line_number) { \
5861 return operator new (size, block_use, file_name, line_number); \
5962 }\
60- void operator delete (void * block, int const block_use, char const * file_name, int const line_number) noexcept { \
63+ void operator delete (void * block, int const block_use, char const * file_name, int const line_number) { \
6164 \
6265 return _aligned_free_dbg (block); \
6366 } \
64- void operator delete[] (void * block, int const block_use, char const * file_name, int const line_number) noexcept { \
67+ void operator delete[] (void * block, int const block_use, char const * file_name, int const line_number) { \
6568 return operator delete (block, block_use, file_name, line_number); \
6669 }
67-
6870#endif
6971#endif
7072#else
71- #define PDB_MAKE_ALIGNED_OPERATOR_NEW
73+ #define PBD_MAKE_ALIGNED_OPERATOR_NEW
74+
75+ #if defined(WIN32) || defined(_WIN32) || defined(WIN64)
76+ // Enable memory leak detection
77+ #ifdef _DEBUG
78+ #define _CRTDBG_MAP_ALLOC
79+ #include < stdlib.h>
80+ #include < crtdbg.h>
81+ #define DEBUG_NEW new (_NORMAL_BLOCK, __FILE__, __LINE__)
82+ #define REPORT_MEMORY_LEAKS _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
83+ #else
84+ #define REPORT_MEMORY_LEAKS
85+ #endif
86+ #else
87+ #define REPORT_MEMORY_LEAKS
88+ #endif
89+
7290#endif
7391}
7492
7593#endif
94+
95+ #if defined(WIN32) || defined(_WIN32) || defined(WIN64)
96+ #define FORCE_INLINE __forceinline
97+ #else
98+ #define FORCE_INLINE __attribute__ ((always_inline))
99+ #endif
100+
101+
0 commit comments