[Bf-blender-cvs] [468adfa4fd9] master: Guarded allocator: Override placement new operator

Sergey Sharybin noreply at git.blender.org
Fri Jul 3 12:31:04 CEST 2020


Commit: 468adfa4fd9fab09f2ceeca40ab3c72e071931c6
Author: Sergey Sharybin
Date:   Fri Jul 3 12:21:05 2020 +0200
Branches: master
https://developer.blender.org/rB468adfa4fd9fab09f2ceeca40ab3c72e071931c6

Guarded allocator: Override placement new operator

Allows to in-place construct objects which are using guarded allocator.

===================================================================

M	intern/guardedalloc/MEM_guardedalloc.h

===================================================================

diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index bbba69edf1d..55ea1d0bb70 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -239,6 +239,10 @@ void MEM_use_guarded_allocator(void);
     { \
       if (mem) \
         MEM_freeN(mem); \
+    } \
+    void *operator new(size_t /*count*/, void *ptr) \
+    { \
+      return ptr; \
     }
 
 /* Needed when type includes a namespace, then the namespace should not be



More information about the Bf-blender-cvs mailing list