Function libmimalloc_sys::mi_register_error

source ·
pub unsafe extern "C" fn mi_register_error(
    out: mi_error_fun,
    arg: *mut c_void
)
Expand description

Register an error callback function.

The errfun function is called on an error in mimalloc after emitting an error message (through the output function).

It as always legal to just return from the errfun function in which case allocation functions generally return null or ignore the condition.

The default function only calls abort() when compiled in secure mode with an EFAULT error. The possible error codes are:

  • EAGAIN (11): Double free was detected (only in debug and secure mode).
  • EFAULT (14): Corrupted free list or meta-data was detected (only in debug and secure mode).
  • ENOMEM (12): Not enough memory available to satisfy the request.
  • EOVERFLOW (75): Too large a request, for example in mi_calloc, the count and size parameters are too large.
  • EINVAL (22): Trying to free or re-allocate an invalid pointer.

Note: This function is thread safe.