LibJS: Round cell sizes up to a multiple of 16 bytes
This increases HeapBlock utilization significantly (and reduces overall memory usage.)
This commit is contained in:
parent
2106dafd62
commit
6c3afca686
Notes:
sideshowbarker
2024-07-19 08:12:25 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6c3afca6866
1 changed files with 2 additions and 1 deletions
|
@ -60,7 +60,8 @@ Cell* Heap::allocate_cell(size_t size)
|
|||
return cell;
|
||||
}
|
||||
|
||||
auto block = HeapBlock::create_with_cell_size(*this, size);
|
||||
size_t cell_size = round_up_to_power_of_two(size, 16);
|
||||
auto block = HeapBlock::create_with_cell_size(*this, cell_size);
|
||||
auto* cell = block->allocate();
|
||||
m_blocks.append(move(block));
|
||||
return cell;
|
||||
|
|
Loading…
Add table
Reference in a new issue