From 185781ef5265261e1e982bbdfc8233d0f2046190 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Tue, 19 May 2020 10:21:00 +0100 Subject: [PATCH] Add error message for failure during init! --- src/mem/alloc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mem/alloc.h b/src/mem/alloc.h index 82005df..34171a3 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -847,8 +847,12 @@ namespace snmalloc void init_message_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(alloc(MIN_ALLOC_SIZE)); + if (dummy == nullptr) + { + error("Critical error: Out-of-memory during initialisation."); + } dummy->set_target_id(id()); message_queue().init(dummy); }