diff options
Diffstat (limited to 'kernel/include')
| -rw-r--r-- | kernel/include/kernel/memory/block_list_allocator.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/include/kernel/memory/block_list_allocator.hpp b/kernel/include/kernel/memory/block_list_allocator.hpp index 977ce89..5e81c44 100644 --- a/kernel/include/kernel/memory/block_list_allocator.hpp +++ b/kernel/include/kernel/memory/block_list_allocator.hpp @@ -42,12 +42,21 @@ namespace kernel::memory private: struct block_header final { - std::size_t size; + std::size_t usable_size; bool free; block_header * next; block_header * prev; }; + //! The size of the metadata required for each allocated block. + //! + //! Each allocated block carries a block header, like any unallocated one, but in addition also has a back-pointer + //! to the block header to support padding due to alignment. + constexpr auto static allocated_metadata_size = sizeof(block_header) + sizeof(block_header *); + + //! The minimum number of bytes for an allocation. + constexpr auto static minimum_allocation_size = 16uz; + //! Try to expand the heap to accommodate the given size. //! //! @param delta The size to expand the heap by. |
