From cc0784c1b9c4d813837dedddd5b2b4c52fe291f0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Jun 2012 09:14:37 +0000 Subject: optionally use guarded alloc for tiles compositor, also replace allocation functions with a macro. --- intern/guardedalloc/MEM_guardedalloc.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'intern/guardedalloc') diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 83d6549218a..bb4c372e46d 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -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 -- cgit v1.2.3