12#ifdef WITH_BLENDER_GUARDEDALLOC
36 T *
allocate(
const size_t n,
const void *hint =
nullptr)
39 size_t size = n *
sizeof(
T);
45#ifdef WITH_BLENDER_GUARDEDALLOC
53 mem = (
T *)malloc(size);
56 throw std::bad_alloc();
65#ifdef WITH_BLENDER_GUARDEDALLOC
110#if defined(_MSC_VER) && _ITERATOR_DEBUG_LEVEL
130 template<>
struct rebind<std::_Container_proxy> {
131 typedef std::allocator<std::_Container_proxy>
other;
134 operator std::allocator<std::_Container_proxy>()
const
136 return std::allocator<std::_Container_proxy>();
153#define MEM_GUARDED_CALL(progress, func, ...) \
156 (func)(__VA_ARGS__); \
158 catch (std::bad_alloc &) { \
159 LOG_ERROR << "Out of memory"; \
161 (progress)->set_error("Out of memory"); \
Read Blender memory allocation and freeing.
bool operator!=(const GuardedAllocator &other) const
const T & const_reference
GuardedAllocator< T > & operator=(const GuardedAllocator &)=default
bool operator==(const GuardedAllocator &) const
T * allocate(const size_t n, const void *hint=nullptr)
GuardedAllocator & operator=(const GuardedAllocator< U > &)
GuardedAllocator(const GuardedAllocator< U > &)
GuardedAllocator()=default
const T * address(const T &x) const
ptrdiff_t difference_type
GuardedAllocator(const GuardedAllocator &)=default
void deallocate(T *p, const size_t n)
#define CCL_NAMESPACE_END
size_t util_guarded_get_mem_used()
size_t util_guarded_get_mem_peak()
void util_guarded_mem_alloc(const size_t n)
void util_guarded_mem_free(const size_t n)
void MEM_delete_void(void *vmemh)
void * MEM_new_uninitialized_aligned(size_t len, size_t alignment, const char *str)
GuardedAllocator< U > other