Blender  V3.3
mallocn.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "../MEM_guardedalloc.h"
8 #include <new>
9 
10 void *operator new(size_t size, const char *str);
11 void *operator new[](size_t size, const char *str);
12 
13 /* not default but can be used when needing to set a string */
14 void *operator new(size_t size, const char *str)
15 {
16  return MEM_mallocN(size, str);
17 }
18 void *operator new[](size_t size, const char *str)
19 {
20  return MEM_mallocN(size, str);
21 }
22 
23 void *operator new(size_t size)
24 {
25  return MEM_mallocN(size, "C++/anonymous");
26 }
27 void *operator new[](size_t size)
28 {
29  return MEM_mallocN(size, "C++/anonymous[]");
30 }
31 
32 void operator delete(void *p) throw()
33 {
34  /* delete NULL is valid in c++ */
35  if (p)
36  MEM_freeN(p);
37 }
38 void operator delete[](void *p) throw()
39 {
40  /* delete NULL is valid in c++ */
41  if (p)
42  MEM_freeN(p);
43 }
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
#define str(s)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33