Blender V5.3
mem_guarded::internal Namespace Reference

Enumerations

enum class  DestructorType { Trivial , NonTrivial }

Functions

void * ATTR_NONNULL (3)
void add_memleak_data (std::any data)

Variables

void(*) mem_freeN_ex (void *vmemh, DestructorType destructor_type) = MEM_lockfree_freeN
void *(*) mem_callocN (size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2) = MEM_lockfree_callocN
void *(*) mem_calloc_arrayN (size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1 = MEM_lockfree_calloc_arrayN
void *(*) mem_mallocN (size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2) = MEM_lockfree_mallocN
void *(*) mem_malloc_arrayN (size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1 = MEM_lockfree_malloc_arrayN
void *(*) mem_mallocN_aligned_ex (size_t len, size_t alignment, const char *str, DestructorType destructor_type)
void *(*) mem_dupallocN (const void *vmemh) ATTR_WARN_UNUSED_RESULT = MEM_lockfree_dupallocN

Enumeration Type Documentation

◆ DestructorType

Enumerator
Trivial 

Allocation has a trivial destructor.

NonTrivial 

Allocation has a non-trivial destructor that should be called when freeing.

Definition at line 15 of file mallocn_intern_function_pointers.hh.

Function Documentation

◆ add_memleak_data()

void mem_guarded::internal::add_memleak_data ( std::any data)

Store a std::any into a static opaque storage vector. The only purpose of this call is to control the lifetime of the given data, there is no way to access it from here afterwards. User code is expected to keep its own reference to the data contained in the std::any as long as it needs it.

Typically, this any should contain a shared_ptr to the actual data, to ensure that the data itself is not duplicated, and that the static storage does become an owner of it.

That way, the memleak data does not get destructed before the static storage is. Since this storage is created before the memleak detection data (see the implementation of MEM_init_memleak_detection), it is guaranteed to happen after the execution and destruction of the memleak detector.

Definition at line 87 of file leak_detector.cc.

References lock.

Referenced by ATTR_NONNULL(), and MEM_init_memleak_detection().

◆ ATTR_NONNULL()

Variable Documentation

◆ mem_calloc_arrayN

void *(* mem_guarded::internal::mem_calloc_arrayN)(size_t len, size_t size, const char *str) ( size_t len,
size_t size,
const char * str ) = MEM_lockfree_calloc_arrayN
extern

Internal implementation of MEM_new_array_zeroed, exposed because public MEM_new_array_zeroed cannot be a function pointer, to allow its overload by C++ template version.

Definition at line 38 of file mallocn.cc.

Referenced by MEM_new_array_zeroed(), MEM_use_guarded_allocator(), and MEM_use_lockfree_allocator().

◆ mem_callocN

void *(* mem_guarded::internal::mem_callocN)(size_t len, const char *str) ( size_t len,
const char * str ) = MEM_lockfree_callocN
extern

Internal implementation of MEM_new_zeroed, exposed because public MEM_new_zeroed cannot be a function pointer, to allow its overload by C++ template version.

Definition at line 37 of file mallocn.cc.

Referenced by MEM_new_zeroed(), MEM_use_guarded_allocator(), and MEM_use_lockfree_allocator().

◆ mem_dupallocN

void *(* mem_guarded::internal::mem_dupallocN)(const void *vmemh) ( const void * vmemh) = MEM_lockfree_dupallocN
extern

Internal implementation of MEM_dupalloc_void, exposed because public MEM_dupalloc_void cannot be a function pointer, to allow its overload by C++ template version.

Definition at line 30 of file mallocn.cc.

Referenced by ATTR_NONNULL(), MEM_dupalloc_void(), MEM_use_guarded_allocator(), and MEM_use_lockfree_allocator().

◆ mem_freeN_ex

void(* mem_guarded::internal::mem_freeN_ex)(void *vmemh, DestructorType destructor_type) ( void * vmemh,
DestructorType destructor_type ) = MEM_lockfree_freeN
extern

Internal implementation of MEM_delete_void, exposed because #MEM_delete needs access to it.

Definition at line 28 of file mallocn.cc.

Referenced by MEM_delete_void(), MEM_use_guarded_allocator(), and MEM_use_lockfree_allocator().

◆ mem_malloc_arrayN

void *(* mem_guarded::internal::mem_malloc_arrayN)(size_t len, size_t size, const char *str) ( size_t len,
size_t size,
const char * str ) = MEM_lockfree_malloc_arrayN
extern

Internal implementation of MEM_new_array_uninitialized, exposed because public MEM_new_array_uninitialized cannot be a function pointer, to allow its overload by C++ template version.

Definition at line 42 of file mallocn.cc.

Referenced by ATTR_NONNULL(), MEM_new_array_uninitialized(), MEM_use_guarded_allocator(), and MEM_use_lockfree_allocator().

◆ mem_mallocN

void *(* mem_guarded::internal::mem_mallocN)(size_t len, const char *str) ( size_t len,
const char * str ) = MEM_lockfree_mallocN
extern

Internal implementation of MEM_new_uninitialized, exposed because public MEM_new_uninitialized cannot be a function pointer, to allow its overload by C++ template version.

Definition at line 41 of file mallocn.cc.

Referenced by ATTR_NONNULL(), mem_guarded_malloc_arrayN_aligned(), mem_lockfree_malloc_arrayN_aligned(), MEM_new_uninitialized(), MEM_use_guarded_allocator(), and MEM_use_lockfree_allocator().

◆ mem_mallocN_aligned_ex

void *(* mem_guarded::internal::mem_mallocN_aligned_ex)(size_t len, size_t alignment, const char *str, DestructorType destructor_type) ( size_t len,
size_t alignment,
const char * str,
DestructorType destructor_type )
extern
Initial value:
=
void * MEM_lockfree_mallocN_aligned(size_t len, size_t alignment, const char *str, mem_guarded::internal::DestructorType destructor_type) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3)

Internal implementation of MEM_new_uninitialized_aligned, exposed because #MEM_new needs access to it.

Definition at line 45 of file mallocn.cc.

Referenced by ATTR_NONNULL(), MEM_new_uninitialized_aligned(), MEM_use_guarded_allocator(), and MEM_use_lockfree_allocator().