apps/boot_heap_allocator.cc
/**
 * @brief Default mi-malloc error handler.
 * @param error_no The possible error codes are:
 * * EAGAIN: Double free was detected (only in debug and secure mode).
 * * EFAULT: Corrupted free list or meta-data was detected (only in debug and
 * secure mode).
 * * ENOMEM: Not enough memory available to satisfy the request.
 * * EOVERFLOW: Too large a request, for example in mi_calloc(), the count and
 * size parameters are too large.
 * * EINVAL: Trying to free or re-allocate an invalid pointer.
 * @param arg Extra argument that will be passed on to the error function.
 * @return void.
 */
@brief Default mi-malloc error handler.
@param error_no The possible error codes are:
EAGAIN: Double free was detected (only in debug and secure mode).
EFAULT: Corrupted free list or meta-data was detected (only in debug and
secure mode).
ENOMEM: Not enough memory available to satisfy the request.
EOVERFLOW: Too large a request, for example in mi_calloc(), the count and
size parameters are too large.
EINVAL: Trying to free or re-allocate an invalid pointer.
@param arg Extra argument that will be passed on to the error function.
@return void.
@brief Default mi - malloc error handler . @param error_no The possible error codes are : EAGAIN : Double free was detected ( only in debug and secure mode ) . EFAULT : Corrupted free list or meta - data was detected ( only in debug and secure mode ) . ENOMEM : Not enough memory available to satisfy the request . EOVERFLOW : Too large a request for example in mi_calloc () the count and size parameters are too large . EINVAL : Trying to free or re - allocate an invalid pointer . @param arg Extra argument that will be passed on to the error function . @return void .
void DefaultMiMallocError(int error_no, [[maybe_unused]] void* arg) noexcept {
  const auto error_code{base::std2::system_last_error_code(error_no)};
  G3PLOG_E(WARNING, error_code) << "Mi-malloc error: ";
#ifndef NDEBUG
  if (error_no == EFAULT) {
#ifdef WB_COMPILER_MSVC
    __debugbreak();
#endif
    std::abort();
  }
#else
#ifdef WB_MI_SECURE
  if (error_no == EFAULT) {
    std::abort();
  }
#endif
#endif  
}
void DefaultMiMallocError ( int error_no , [[ maybe_unused ]] void * arg ) noexcept { const auto error_code { base :: std2 :: system_last_error_code ( error_no ) } ; G3PLOG_E ( WARNING , error_code ) << " " ; #ifndef NDEBUG if ( error_no == EFAULT ) { #ifdef WB_COMPILER_MSVC __debugbreak ( ) ; #endif std :: abort ( ) ; } #else #ifdef WB_MI_SECURE if ( error_no == EFAULT ) { std :: abort ( ) ; } #endif #endif }
@brief Default mi-malloc error handler.
@brief Default mi - malloc error handler .
// Abort on serious errors in secure mode (corrupted meta-data). // NDEBUG // It as always legal to just return from the 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.