From 1b88c4cc62c3ba7f17dc10adcabccd2b0a7aaab1 Mon Sep 17 00:00:00 2001 From: dzaima Date: Wed, 7 Dec 2022 22:22:34 +0200 Subject: [PATCH] don't allocate twice the memory requested --- src/opt/mm_buddyTemplate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opt/mm_buddyTemplate.c b/src/opt/mm_buddyTemplate.c index 2cae5d89..b9a41ea0 100644 --- a/src/opt/mm_buddyTemplate.c +++ b/src/opt/mm_buddyTemplate.c @@ -65,6 +65,7 @@ NOINLINE void* BN(allocS)(i64 bucket, u8 type) { i64 from = to; EmptyValue* c; while (true) { + if (from >= ALSZ) return BN(allocateMore)(bucket, type, from, to); from++; if (buckets[from]) { c = buckets[from]; @@ -72,7 +73,6 @@ NOINLINE void* BN(allocS)(i64 bucket, u8 type) { buckets[from] = vg_def_v(c->next); break; } - if (from >= ALSZ) return BN(allocateMore)(bucket, type, from, to); } BN(splitTo)(c, from, to, true); assert(buckets[bucket]!=NULL);