Merge pull request #190 from mjp41/error_message

Add error message for failure during init.
This commit is contained in:
Matthew Parkinson
2020-05-20 10:40:59 +01:00
committed by GitHub

View File

@@ -842,8 +842,12 @@ namespace snmalloc
void init_message_queue() void init_message_queue()
{ {
// Manufacture an allocation to prime the queue // Manufacture an allocation to prime the queue
// Using an actual allocation removes a conditional of a critical path. // Using an actual allocation removes a conditional from a critical path.
Remote* dummy = reinterpret_cast<Remote*>(alloc<YesZero>(MIN_ALLOC_SIZE)); Remote* dummy = reinterpret_cast<Remote*>(alloc<YesZero>(MIN_ALLOC_SIZE));
if (dummy == nullptr)
{
error("Critical error: Out-of-memory during initialisation.");
}
dummy->set_target_id(id()); dummy->set_target_id(id());
message_queue().init(dummy); message_queue().init(dummy);
} }