Use size of current block for doubling, not total
This commit is contained in:
@@ -376,10 +376,9 @@ void ArenaAllocator::add_block(size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t ArenaAllocator::calculate_next_block_size(size_t required_size) const {
|
size_t ArenaAllocator::calculate_next_block_size(size_t required_size) const {
|
||||||
size_t doubled_size = total_allocated() * 2;
|
size_t doubled_size = (current_block_ ? current_block_->size : 0) * 2;
|
||||||
doubled_size =
|
doubled_size =
|
||||||
std::min<size_t>(doubled_size, std::numeric_limits<uint32_t>::max());
|
std::min<size_t>(doubled_size, std::numeric_limits<uint32_t>::max());
|
||||||
|
|
||||||
return std::max(required_size, doubled_size);
|
return std::max(required_size, doubled_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user