memory
|
The exception class thrown when a low level allocator runs out of memory.
It is derived from std::bad_alloc
. This can happen if a low level allocation function like std::malloc()
runs out of memory. Throwing can be prohibited by the handler function.
Typedefs | |
using | handler = void(*)(const allocator_info &info, std::size_t amount) |
The type of the handler called in the constructor of out_of_memory. | |
Static Functions | |
static handler | set_handler (handler h) |
static handler | get_handler () |
Member Functions | |
out_of_memory (const allocator_info &info, std::size_t amount) | |
const char * | what () const noexcept override |
const allocator_info & | allocator () const noexcept |
std::size_t | failed_allocation_size () const noexcept |
using handler = void (*)(const allocator_info& info, std::size_t amount) |
The type of the handler called in the constructor of out_of_memory.
When an out of memory situation is encountered and the exception class created, this handler gets called. It is especially useful if exception support is disabled. It gets the allocator_info and the amount of memory that was tried to be allocated.
std::bad_alloc
or abort the program. If it returns, this exception object will be created and thrown. stderr
and continues execution, leading to this exception being thrown. On a freestanding implementation it does nothing. std::new_handler
; it will not be called in a loop trying to allocate memory or something like that. Its only job is to report the error. out_of_memory | ( | const allocator_info & | info, |
std::size_t | amount | ||
) |
|
overridenoexcept |
|
noexcept |
|
noexcept |