4 #ifndef __UTIL_GUARDED_ALLOCATOR_H__
5 #define __UTIL_GUARDED_ALLOCATOR_H__
11 #ifdef WITH_BLENDER_GUARDEDALLOC
12 # include "../../guardedalloc/MEM_guardedalloc.h"
42 size_t size = n *
sizeof(
T);
48 #ifdef WITH_BLENDER_GUARDEDALLOC
56 mem = (
T *)malloc(
size);
59 throw std::bad_alloc();
68 #ifdef WITH_BLENDER_GUARDEDALLOC
135 template<>
struct rebind<
std::_Container_proxy> {
136 typedef std::allocator<std::_Container_proxy>
other;
139 operator std::allocator<std::_Container_proxy>()
const
141 return std::allocator<std::_Container_proxy>();
158 #define MEM_GUARDED_CALL(progress, func, ...) \
161 (func)(__VA_ARGS__); \
163 catch (std::bad_alloc &) { \
164 fprintf(stderr, "Error: run out of memory!\n"); \
166 (progress)->set_error("Out of memory"); \
void BLI_kdtree_nd_() free(KDTree *tree)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
T * allocate(size_t n, const void *hint=0)
const T * address(const T &x) const
GuardedAllocator(const GuardedAllocator &)
bool operator==(GuardedAllocator const &) const
const T & const_reference
bool operator!=(GuardedAllocator const &other) const
GuardedAllocator & operator=(const GuardedAllocator< U > &)
GuardedAllocator(const GuardedAllocator< U > &)
GuardedAllocator< T > & operator=(const GuardedAllocator &)
void deallocate(T *p, size_t n)
ptrdiff_t difference_type
#define CCL_NAMESPACE_END
SyclQueue void void size_t num_bytes void
size_t util_guarded_get_mem_used()
size_t util_guarded_get_mem_peak()
void util_guarded_mem_free(size_t n)
CCL_NAMESPACE_BEGIN void util_guarded_mem_alloc(size_t n)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN_aligned)(size_t len, size_t alignment, const char *str)
GuardedAllocator< U > other