![]() |
Max OS 0.3
|
Basic doubly linked list bump memory allocator. More...
#include <bump.h>
Public Member Functions | |
| BumpAllocator () | |
| Creates a new bump memory allocator. | |
| virtual | ~BumpAllocator () |
| Destructs a Bump memory allocator. | |
| void | setup_region (uintptr_t address, size_t length) final |
| Setup a region to be bump memory managed, creates a free chunk represent the whole region. | |
| void * | allocate (size_t size) final |
| Allocates a block of memory. | |
| void | unallocate (void *pointer) final |
| Frees a block of memory. | |
| size_t | amount_used () final |
| Returns the amount of memory used. | |
| size_t | align (size_t size) final |
| Aligns the size to the chunk alignment. | |
Public Member Functions inherited from MaxOS::memory::allocator::MemoryAllocator | |
| MemoryAllocator () | |
| virtual | ~MemoryAllocator () |
| BumpAllocator::BumpAllocator | ( | ) |
|
finalvirtual |
Aligns the size to the chunk alignment.
| size | The size to align |
Reimplemented from MaxOS::memory::allocator::MemoryAllocator.
Definition at line 290 of file bump.cpp.
Referenced by allocate().
|
finalvirtual |
Allocates a block of memory.
| size | The size of the block to allocate |
Reimplemented from MaxOS::memory::allocator::MemoryAllocator.
Definition at line 144 of file bump.cpp.
References align(), MaxOS::memory::allocator::ChunkHeader::allocated, MaxOS::memory::allocator::ChunkHeader::canary, MaxOS::memory::allocator::ChunkHeader::next, MaxOS::memory::allocator::ChunkHeader::next_chunk(), MaxOS::memory::allocator::ChunkHeader::prev, and MaxOS::memory::allocator::ChunkHeader::size.
Referenced by MaxOS::memory::MemoryManager::kmalloc(), MaxOS::memory::MemoryManager::malloc(), and MaxOS::processes::Thread::Thread().
|
finalvirtual |
Returns the amount of memory used.
Reimplemented from MaxOS::memory::allocator::MemoryAllocator.
Definition at line 272 of file bump.cpp.
References MaxOS::memory::allocator::ChunkHeader::next_chunk().
|
finalvirtual |
Setup a region to be bump memory managed, creates a free chunk represent the whole region.
| address | The start of the region |
| length | The length of the region |
Reimplemented from MaxOS::memory::allocator::MemoryAllocator.
Definition at line 122 of file bump.cpp.
References MaxOS::memory::allocator::ChunkHeader::allocated, MaxOS::memory::allocator::ChunkHeader::canary, MaxOS::memory::allocator::ChunkHeader::next, MaxOS::memory::allocator::ChunkHeader::prev, and MaxOS::memory::allocator::ChunkHeader::size.
Referenced by MaxOS::processes::resources::BridgeHandler::BridgeHandler(), and MaxOS::memory::BumpMemoryManager::BumpMemoryManager().
|
finalvirtual |
Frees a block of memory.
| pointer | A pointer to the block |
Reimplemented from MaxOS::memory::allocator::MemoryAllocator.
Definition at line 212 of file bump.cpp.
References MaxOS::memory::allocator::ChunkHeader::prev_chunk(), and MaxOS::memory::allocator::ChunkHeader::size.
Referenced by MaxOS::memory::MemoryManager::free(), MaxOS::memory::MemoryManager::kfree(), and MaxOS::processes::resources::BridgeHandler::send_to_bridge().