Installs a new bad alloc error handler that should be used whenever a bad alloc error, e.g. failing malloc/calloc, is encountered by LLVM.
Synopsis
Declared in <llvm/Support/ErrorHandling.h>
void
install_bad_alloc_error_handler(
fatal_error_handler_t handler,
void* user_data = nullptr);
Description
The user can install a bad alloc handler, in order to define the behavior in case of failing allocations, e.g. throwing an exception. Note that this handler must not trigger any additional allocations itself.
If no error handler is installed the default is to print the error message to stderr, and call exit(1). If an error handler is installed then it is the handler's responsibility to log the message, it will no longer be printed to stderr. If the error handler returns, then exit(1) will be called.
Parameters
Name |
Description |
handler |
‐ The bad alloc error handler to install. |
user_data |
‐ An argument which will be passed to the installed error handler. |
Created with MrDocs