#include <modm/driver/storage/block_allocator.hpp>
|
void | initialize (void *heapStart, void *heapEnd) |
|
void * | allocate (std::size_t requestedSize) |
| Allocate memory.
|
|
void | free (void *ptr) |
|
std::size_t | getAvailableSize () const |
|
template<typename T, unsigned int BLOCK_SIZE>
class modm::BlockAllocator< T, BLOCK_SIZE >
Memory allocator.
- Template Parameters
-
BLOCK_SIZE | Size of one allocatable block in words (sizeof(T) bytes) (BLOCKSIZE * sizeof(T) * n) - 4 has to be dividable by 4 for every n |
- Author
- Fabian Greif
template<typename T , unsigned int BLOCK_SIZE>
void modm::BlockAllocator< T, BLOCK_SIZE >::free |
( |
void * |
ptr | ) |
|
Free memory in O(1)
- Parameters
-
ptr | Must be the same pointer previously acquired by allocate(). |
template<typename T , unsigned int BLOCK_SIZE>
void modm::BlockAllocator< T, BLOCK_SIZE >::initialize |
( |
void * |
heapStart, |
|
|
void * |
heapEnd |
|
) |
| |
Initialize the raw memory.
Needs to called before any calls to allocate() or free(). Must be called only once!
- Parameters
-
heapStart | Needs to point to the first available byte |
heapEnd | Needs to point directly above the last available memory position. |
The documentation for this class was generated from the following file: