optionally use guarded alloc for tiles compositor, also replace allocation functions...
[blender.git] / intern / guardedalloc / MEM_guardedalloc.h
index 83d6549218aadc09a2440672808142f2bb8d2bc1..bb4c372e46ddb149e58762e4c8ef038be315f305 100644 (file)
@@ -167,7 +167,27 @@ extern "C" {
 #ifndef NDEBUG
 const char *MEM_name_ptr(void *vmemh);
 #endif
-       
+
+#ifdef __cplusplus
+/* alloc funcs for C++ only */
+#define MEM_CXX_CLASS_ALLOC_FUNCS(_id)                                        \
+public:                                                                       \
+       void *operator new(size_t num_bytes) {                                    \
+               return MEM_mallocN(num_bytes, _id);                                   \
+       }                                                                         \
+       void operator delete(void *mem) {                                         \
+               MEM_freeN(mem);                                                       \
+       }                                                                         \
+       void *operator new[](size_t num_bytes) {                                  \
+               return MEM_mallocN(num_bytes, _id "[]");                              \
+       }                                                                         \
+       void operator delete[](void *mem) {                                       \
+               MEM_freeN(mem);                                                       \
+       }                                                                         \
+
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif