-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Why
This will provide an easy way for developers to create allocators for their code and drivers that do not need deallocation support.
Usage
void initialize_platform() {
auto driver_allocator = mem::make_monotonic_allocator<1024>();
auto stm32f1 = hal::stm32f1::init(driver_allocator);
// do the rest...
}Function signature
template<size_t N>
monotonic_allocator make_monotonic_allocator();Requirements
This monotonic allocator will differ from the standard one in the following ways:
- Stores memory internally such that the lifetime of the memory and the allocator are bound to each other.
- Will not have a fallback allocator, meaning if memory runs out, it will throw an exception that inherits from
std::bad_alloctype. - Will never deallocate memory, BUT records the total amount of deallocations. When the allocator's destructor is called, the allocation and deallocation amounts must be equal, otherwise
std::terminateis called.
Metadata
Metadata
Assignees
Labels
No labels