Blender  V3.3
Classes | Macros | Functions
guarded_allocator.h File Reference
#include <cstddef>
#include <cstdlib>
#include <memory>

Go to the source code of this file.

Classes

class  GuardedAllocator< T >
 
struct  GuardedAllocator< T >::rebind< U >
 

Macros

#define MEM_GUARDED_CALL(progress, func, ...)
 

Functions

CCL_NAMESPACE_BEGIN void util_guarded_mem_alloc (size_t n)
 
void util_guarded_mem_free (size_t n)
 
size_t util_guarded_get_mem_used ()
 
size_t util_guarded_get_mem_peak ()
 

Macro Definition Documentation

◆ MEM_GUARDED_CALL

#define MEM_GUARDED_CALL (   progress,
  func,
  ... 
)
Value:
do { \
try { \
(func)(__VA_ARGS__); \
} \
catch (std::bad_alloc &) { \
fprintf(stderr, "Error: run out of memory!\n"); \
fflush(stderr); \
(progress)->set_error("Out of memory"); \
} \
} while (false)

Definition at line 158 of file guarded_allocator.h.

Function Documentation

◆ util_guarded_get_mem_peak()

size_t util_guarded_get_mem_peak ( )

Definition at line 30 of file guarded_allocator.cpp.

References global_stats(), and Stats::mem_peak.

Referenced by Scene::device_update().

◆ util_guarded_get_mem_used()

size_t util_guarded_get_mem_used ( )

Definition at line 25 of file guarded_allocator.cpp.

References global_stats(), and Stats::mem_used.

Referenced by Scene::device_update().

◆ util_guarded_mem_alloc()

CCL_NAMESPACE_BEGIN void util_guarded_mem_alloc ( size_t  n)

◆ util_guarded_mem_free()

void util_guarded_mem_free ( size_t  n)