don't allocate twice the memory requested

This commit is contained in:
dzaima 2022-12-07 22:22:34 +02:00
parent 49c0d9a355
commit 1b88c4cc62

View File

@ -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);