49 #ifndef __MEM_GUARDEDALLOC_H__
50 #define __MEM_GUARDEDALLOC_H__
53 #include "../../source/blender/blenlib/BLI_compiler_attrs.h"
54 #include "../../source/blender/blenlib/BLI_sys_types.h"
76 extern short (*MEM_testN)(
void *vmemh);
89 extern void *(*MEM_reallocN_id)(
void *vmemh,
97 extern void *(*MEM_recallocN_id)(
void *vmemh,
102 #define MEM_reallocN(vmemh, len) MEM_reallocN_id(vmemh, len, __func__)
103 #define MEM_recallocN(vmemh, len) MEM_recallocN_id(vmemh, len, __func__)
191 # define MEM_SAFE_FREE(v) \
193 typeof(&(v)) _v = &(v); \
196 MEM_freeN((void *)*_v); \
201 # define MEM_SAFE_FREE(v) \
203 void **_v = (void **)&(v); \
212 #define MEM_SIZE_OVERHEAD sizeof(size_t)
213 #define MEM_SIZE_OPTIMAL(size) ((size)-MEM_SIZE_OVERHEAD)
216 extern const char *(*MEM_name_ptr)(
void *vmemh);
262 # define MEM_CXX_CLASS_ALLOC_FUNCS(_id) \
264 void *operator new(size_t num_bytes) \
266 return MEM_mallocN(num_bytes, _id); \
268 void operator delete(void *mem) \
274 void *operator new[](size_t num_bytes) \
276 return MEM_mallocN(num_bytes, _id "[]"); \
278 void operator delete[](void *mem) \
284 void *operator new(size_t
, void *ptr) \
290 void operator delete(void * , void * ) \
296 template<
class T>
inline void OBJECT_GUARDED_DESTRUCTOR(
T *what)
301 # if defined __GNUC__
302 # define OBJECT_GUARDED_NEW(type, args...) new (MEM_mallocN(sizeof(type), __func__)) type(args)
304 # define OBJECT_GUARDED_NEW(type, ...) \
305 new (MEM_mallocN(sizeof(type), __FUNCTION__)) type(__VA_ARGS__)
307 # define OBJECT_GUARDED_DELETE(what, type) \
310 OBJECT_GUARDED_DESTRUCTOR((type *)what); \
315 # define OBJECT_GUARDED_SAFE_DELETE(what, type) \
318 OBJECT_GUARDED_DESTRUCTOR((type *)what); \
#define ATTR_ALLOC_SIZE(...)
void BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() ATTR_WARN_UNUSED_RESULT
void MEM_use_guarded_allocator(void)
void MEM_use_memleak_detection(bool enabled)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void(* MEM_freeN)(void *vmemh)
void(* MEM_reset_peak_memory)(void)
void MEM_enable_fail_on_memleak(void)
size_t(* MEM_get_memory_in_use)(void)
void(* MEM_printmemlist_stats)(void)
void(* MEM_set_memory_debug)(void)
size_t(* MEM_get_peak_memory)(void) ATTR_WARN_UNUSED_RESULT
void MEM_init_memleak_detection(void)
void *(* MEM_mallocN)(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void(* MEM_set_error_callback)(void(*func)(const char *))
size_t(* MEM_allocN_len)(const void *vmemh) ATTR_WARN_UNUSED_RESULT
void MEM_use_lockfree_allocator(void)
bool(* MEM_consistency_check)(void)
unsigned int(* MEM_get_memory_blocks_in_use)(void)
void(* MEM_printmemlist_pydict)(void)
void *(* ATTR_NONNULL)(3)
Iterator New.
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void *(* MEM_mallocN_aligned)(size_t len, size_t alignment, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3)
void(* MEM_callbackmemlist)(void(*func)(void *))
void(* MEM_printmemlist)(void)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)