17 #ifndef __UTIL_GUARDED_ALLOCATOR_H__
18 #define __UTIL_GUARDED_ALLOCATOR_H__
24 #ifdef WITH_BLENDER_GUARDEDALLOC
25 # include "../../guardedalloc/MEM_guardedalloc.h"
55 size_t size = n *
sizeof(
T);
61 #ifdef WITH_BLENDER_GUARDEDALLOC
69 mem = (
T *)malloc(
size);
72 throw std::bad_alloc();
81 #ifdef WITH_BLENDER_GUARDEDALLOC
148 template<>
struct rebind<
std::_Container_proxy> {
149 typedef std::allocator<std::_Container_proxy>
other;
152 operator std::allocator<std::_Container_proxy>()
const
154 return std::allocator<std::_Container_proxy>();
171 #define MEM_GUARDED_CALL(progress, func, ...) \
174 (func)(__VA_ARGS__); \
176 catch (std::bad_alloc &) { \
177 fprintf(stderr, "Error: run out of memory!\n"); \
179 (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
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN_aligned)(size_t len, size_t alignment, const char *str)
GuardedAllocator< U > other
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)