Add errors for failing to initialise the system.

This commit is contained in:
Matthew Parkinson
2021-07-19 15:45:51 +01:00
committed by Matthew Parkinson
parent 8a8669f957
commit 0b7929327a
2 changed files with 11 additions and 0 deletions

View File

@@ -134,6 +134,11 @@ namespace snmalloc
auto new_body_untyped = PAL::reserve(request_size);
if (new_body_untyped == nullptr)
{
PAL::error("Failed to initialisation snmalloc.");
}
#ifdef SNMALLOC_CHECK_CLIENT
// Begin pagemap at random offset within the additionally allocated space.
static_assert(bits::is_pow2(sizeof(T)), "Next line assumes this.");

View File

@@ -51,6 +51,12 @@ namespace snmalloc
p = ChunkAllocator::alloc_meta_data<T>(
h, nullptr, std::forward<Args>(args)...);
if (p == nullptr)
{
SharedStateHandle::Backend::Pal::error(
"Failed to initialisation thread local allocator.");
}
FlagLock f(pool.lock);
p->list_next = pool.list;
pool.list = p;