mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
Kernel: Add a sanity check for CHUNK_SIZE
Also fixes a spelling mistake in the same file.
This commit is contained in:
parent
d67fd37847
commit
1a9d3e3e54
1 changed files with 3 additions and 1 deletions
|
@ -27,6 +27,8 @@ class Heap {
|
|||
u8 data[0];
|
||||
};
|
||||
|
||||
static_assert(CHUNK_SIZE >= sizeof(AllocationHeader));
|
||||
|
||||
static size_t calculate_chunks(size_t memory_size)
|
||||
{
|
||||
return (sizeof(u8) * memory_size) / (sizeof(u8) * CHUNK_SIZE + 1);
|
||||
|
@ -61,7 +63,7 @@ public:
|
|||
|
||||
Optional<size_t> first_chunk;
|
||||
|
||||
// Choose the right politic for allocation.
|
||||
// Choose the right policy for allocation.
|
||||
constexpr u32 best_fit_threshold = 128;
|
||||
if (chunks_needed < best_fit_threshold) {
|
||||
first_chunk = m_bitmap.find_first_fit(chunks_needed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue