Blender
V4.3
intern
guardedalloc
cpp
mallocn.cpp
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2002-2022 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#include <cstddef>
10
#include <new>
11
12
#include "
../intern/mallocn_intern_function_pointers.hh
"
13
14
using namespace
mem_guarded::internal
;
15
16
void
*
operator
new
(
size_t
size
,
const
char
*
str
);
17
void
*
operator
new
[](
size_t
size
,
const
char
*
str
);
18
19
/* not default but can be used when needing to set a string */
20
void
*
operator
new
(
size_t
size
,
const
char
*
str
)
21
{
22
return
mem_mallocN_aligned_ex
(
size
, 1,
str
,
AllocationType::NEW_DELETE
);
23
}
24
void
*
operator
new
[](
size_t
size
,
const
char
*
str
)
25
{
26
return
mem_mallocN_aligned_ex
(
size
, 1,
str
,
AllocationType::NEW_DELETE
);
27
}
28
29
void
*
operator
new
(
size_t
size
)
30
{
31
return
mem_mallocN_aligned_ex
(
size
, 1,
"C++/anonymous"
,
AllocationType::NEW_DELETE
);
32
}
33
void
*
operator
new
[](
size_t
size
)
34
{
35
return
mem_mallocN_aligned_ex
(
size
, 1,
"C++/anonymous[]"
,
AllocationType::NEW_DELETE
);
36
}
37
38
void
operator
delete
(
void
*p)
throw
()
39
{
40
/* `delete nullptr` is valid in c++. */
41
if
(p) {
42
mem_freeN_ex
(p,
AllocationType::NEW_DELETE
);
43
}
44
}
45
void
operator
delete
[](
void
*p)
throw
()
46
{
47
/* `delete nullptr` is valid in c++. */
48
if
(p) {
49
mem_freeN_ex
(p,
AllocationType::NEW_DELETE
);
50
}
51
}
size
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition
btDbvt.cpp:52
str
#define str(s)
Definition
ffmpeg_codecs.cc:103
mallocn_intern_function_pointers.hh
mem_guarded::internal
Definition
mallocn_intern_function_pointers.hh:11
mem_guarded::internal::AllocationType::NEW_DELETE
@ NEW_DELETE
Definition
mallocn_intern_function_pointers.hh:17
mem_guarded::internal::mem_freeN_ex
void(* mem_freeN_ex)(void *vmemh, AllocationType allocation_type)
Definition
mallocn.cc:37
mem_guarded::internal::mem_mallocN_aligned_ex
void *(* mem_mallocN_aligned_ex)(size_t len, size_t alignment, const char *str, AllocationType allocation_type)
Definition
mallocn.cc:46
Generated on Sat Oct 4 2025 05:32:23 for Blender by
doxygen
1.14.0