17 #ifndef CHECKED_ALLOC_H
18 #define CHECKED_ALLOC_H
20 #define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED 1
22 #include <boost/stacktrace.hpp>
27 #include "../Logger/Logger.h"
28 #include "../Shared/types.h"
34 VLOG(1) <<
"Failed to allocate " << size <<
" bytes " << std::endl
35 << boost::stacktrace::stacktrace();
38 virtual const char*
what() const noexcept final {
return what_str_.c_str(); }
45 auto ptr = malloc(size);
53 auto ptr = calloc(nmemb, size);
64 #endif // CHECKED_ALLOC_H
const std::string what_str_
virtual const char * what() const noexceptfinal
void * checked_malloc(const size_t size)
void * checked_calloc(const size_t nmemb, const size_t size)
OutOfHostMemory(const size_t size)