don't allocate twice the memory requested
This commit is contained in:
parent
49c0d9a355
commit
1b88c4cc62
@ -65,6 +65,7 @@ NOINLINE void* BN(allocS)(i64 bucket, u8 type) {
|
|||||||
i64 from = to;
|
i64 from = to;
|
||||||
EmptyValue* c;
|
EmptyValue* c;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
if (from >= ALSZ) return BN(allocateMore)(bucket, type, from, to);
|
||||||
from++;
|
from++;
|
||||||
if (buckets[from]) {
|
if (buckets[from]) {
|
||||||
c = buckets[from];
|
c = buckets[from];
|
||||||
@ -72,7 +73,6 @@ NOINLINE void* BN(allocS)(i64 bucket, u8 type) {
|
|||||||
buckets[from] = vg_def_v(c->next);
|
buckets[from] = vg_def_v(c->next);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (from >= ALSZ) return BN(allocateMore)(bucket, type, from, to);
|
|
||||||
}
|
}
|
||||||
BN(splitTo)(c, from, to, true);
|
BN(splitTo)(c, from, to, true);
|
||||||
assert(buckets[bucket]!=NULL);
|
assert(buckets[bucket]!=NULL);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user