From 4501c0ed813d23f20867d3070e30e16c52eb18b6 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Thu, 12 Aug 2021 12:01:36 +0100 Subject: [PATCH] corealloc: spurious sizeof() We mean to be allocating MIN_ALLOC_SIZE (== 2 * sizeof(void*)), not sizeof(MIN_ALLOC_SIZE) (== sizeof(size_t)). This doesn't matter in practice since, well, MIN_ALLOC_SIZE is the minimum allocation size, and so requesting either will have the same effect. Still, best to say what we mean. --- src/mem/corealloc.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mem/corealloc.h b/src/mem/corealloc.h index 0097b12..8c34844 100644 --- a/src/mem/corealloc.h +++ b/src/mem/corealloc.h @@ -146,9 +146,8 @@ namespace snmalloc { // Manufacture an allocation to prime the queue // Using an actual allocation removes a conditional from a critical path. - auto dummy = - CapPtr(small_alloc_one(sizeof(MIN_ALLOC_SIZE))) - .template as_static(); + auto dummy = CapPtr(small_alloc_one(MIN_ALLOC_SIZE)) + .template as_static(); if (dummy == nullptr) { error("Critical error: Out-of-memory during initialisation.");