From 9fd80e31931b1f3cf6ef45284ba823986a44b075 Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 4 May 2023 12:26:40 +0300 Subject: [PATCH] split buckets above 2^20 bytes when possible --- src/opt/mm_buddyTemplate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/opt/mm_buddyTemplate.c b/src/opt/mm_buddyTemplate.c index daf8e600..0eed58d0 100644 --- a/src/opt/mm_buddyTemplate.c +++ b/src/opt/mm_buddyTemplate.c @@ -41,6 +41,8 @@ FORCE_INLINE void BN(splitTo)(EmptyValue* c, i64 from, i64 to, bool notEqual) { #endif static NOINLINE void* BN(allocateMore)(i64 bucket, u8 type, i64 from, i64 to) { + if (from >= ALSZ) from = ALSZ; + if (from < (bucket&63)) from = bucket&63; u64 sz = BSZ(from); CHECK_INTERRUPT; @@ -100,7 +102,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); + if (from >= 63) return BN(allocateMore)(bucket, type, from, to); from++; if (buckets[from]) { c = buckets[from];