diff options
Diffstat (limited to 'arch/x86_64/include')
| -rw-r--r-- | arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp | 10 | ||||
| -rw-r--r-- | arch/x86_64/include/arch/memory/heap/memory_block.hpp | 15 |
2 files changed, 12 insertions, 13 deletions
diff --git a/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp b/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp index 5ff13ca..03b8828 100644 --- a/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp +++ b/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp @@ -121,16 +121,6 @@ namespace teachos::arch::memory::heap auto coalesce_free_memory_block(memory_block * previous_block, memory_block * current_block, void * pointer, std::size_t size) -> void; - /** - * @brief Clears the memory of the previous memory block header. - * - * @note Done so the given pointer can be reused to construct other classes into, without having the old values. - * Required because we cannot call delete, because it causes "undefined reference to `sbrk`". - * - * @param pointer Address we want to clear the memory block header at (16 bytes). - */ - auto clear_memory_block_header(void * pointer) -> void; - std::size_t heap_start; ///< Start of the allocatable heap area. std::size_t heap_end; ///< End of the allocatable heap area. memory_block * first; ///< First free entry in our memory. diff --git a/arch/x86_64/include/arch/memory/heap/memory_block.hpp b/arch/x86_64/include/arch/memory/heap/memory_block.hpp index c48d0cd..c62dd57 100644 --- a/arch/x86_64/include/arch/memory/heap/memory_block.hpp +++ b/arch/x86_64/include/arch/memory/heap/memory_block.hpp @@ -12,15 +12,24 @@ namespace teachos::arch::memory::heap struct memory_block { /** - * @brief Constructor, + * @brief Constructor. Clears all memory from the place it was allocated until the end (address + + * size). * * @param size Amount of free memory of this specific hole. * @param next Optional pointer to the next free memory. */ memory_block(std::size_t size, memory_block * next); - std::size_t size; ///< Amount of free memory this hole contains, has to always be atleast 16 bytes to hold the size - ///< variable and the pointer to the next hole. + /** + * @brief Destructor. Clears all internal memory. + * + * @note Used so the memory can be reused to construct other classes into, without having the old values. + * Required because we cannot call delete, because it causes "undefined reference to `sbrk`". + */ + ~memory_block(); + + std::size_t size; ///< Amount of free memory this hole contains, has to always be atleast 16 bytes to hold the + ///< size variable and the pointer to the next hole. memory_block * next; ///< Optional pointer to the next free memory, holds nullptr if there is none. }; } // namespace teachos::arch::memory::heap |
