16#include "pw_allocator/block_allocator.h"
18namespace pw::allocator {
29template <
typename OffsetType = uintptr_t,
30 size_t kPoisonInterval = 0,
31 size_t kAlign =
alignof(OffsetType)>
48 :
Base(region), threshold_(threshold) {}
55 BlockType* ChooseBlock(
Layout layout)
override {
56 if (layout.size() < threshold_) {
58 for (
auto* block : Base::rblocks()) {
59 if (BlockType::AllocLast(block, layout).ok()) {
65 for (
auto* block : Base::blocks()) {
66 if (BlockType::AllocFirst(block, layout).ok()) {
75 size_t threshold_ = 0;
Definition: block_allocator.h:79
Definition: dual_first_fit_block_allocator.h:33
void set_threshold(size_t threshold)
Sets the threshold value for which requests are considered "large".
Definition: dual_first_fit_block_allocator.h:51
constexpr DualFirstFitBlockAllocator()
Constexpr constructor. Callers must explicitly call Init.
Definition: dual_first_fit_block_allocator.h:39
DualFirstFitBlockAllocator(ByteSpan region, size_t threshold)
Definition: dual_first_fit_block_allocator.h:47