43 "total_mapped_bytes would overflow: {}",
63#ifdef BROOM_DEBUG_SLOW
64void FreeListAllocator::PrintList(std::string
prefix,
66 std::println(
"{}",
prefix);
68 std::println(
" {:#x} .. {:#x}",
space.Start(),
space.End());
72bool FreeListAllocator::VerifyLists()
const {
122 FreeList::iterator&
pos,
126 BDEBUG_LOG(
"ALLOCATOR: {:#x} .. {:#x} -> {:#x} .. {:#x}\n",
pos->Start(),
156 FreeList::iterator&
pos,
181 if (
free_list.size() == 0)
return nullptr;
217 "Front metadata should not be currently allocated");
219 "Back metadata should not be currently allocated");
307 "The allocated pointer ({:#x}) must be pointer aligned.",
394 "ALLOCATOR: Coalesce({:#x} .. {:#x}, {:#x} .. {:#x}) -> {:#x} .. "
413 "ALLOCATOR: Coalesce({:#x} .. {:#x}, {:#x} .. {:#x}) -> {:#x} .. "
416 node.value().Start(),
node.value().End());
432 "Couldn't find next range: {:#x} .. {:#x}",
start_next,
445 "ALLOCATOR: Coalesce({:#x} .. {:#x}, {:#x} .. {:#x}, {:#x} .. {:#x}) "
447 " {:#x} .. {:#x}, remove: {:#x}, {:#x}\n",
541 if (!
previous->IsCurrentlyAllocated()) {
542 BDEBUG_LOG(
"ALLOCATOR: Attempt coalesce with previous: {:#x} .. {:#x}\n",
551 "Failed to grow metadata_bottom");
567 if (
next->IsValid()) {
577 if (!
next->IsCurrentlyAllocated()) {
578 BDEBUG_LOG(
"ALLOCATOR: Attempt coalesce with next: {:#x} .. {:#x}\n",
582 "Expected next_bottom to be lesser or equal to the space end: "
588 "Failed to grow next_bottom");
671 if (
metadata->IsCurrentlyAllocated()) {
static constexpr const int kFrontMetadataSize
static size_t SpaceMask(size_t space_size)
static constexpr const int kTotalMetadataSize
static constexpr const int kBackMetadataSize
AllocatorStatistics stats_
virtual void * Allocate(size_t requested_size) override
virtual size_t LargeSpaceThreshold() const override
static constexpr size_t GetRealAllocationSize(size_t requested_size)
void * TryAllocateExactOrFindNext(FreeList &free_list, FreeList::iterator &pos, size_t requested_size)
virtual bool Grow(size_t requested_size, MemorySpace **space_to_update) override
virtual ~FreeListAllocator()
MemorySpace * current_large_space_
FreeList large_free_list_
MemorySpace * current_space_
void AddOrCoalesceFreeListImpl(FreeList &free_list, const MemoryRegion current, const MemoryRegion previous, const MemoryRegion next, const MemoryRegion coalesced)
std::vector< MemorySpace > spaces_
void FillSpaceAndAddToFreeList(FreeList *list, MemorySpace *space)
void * TryAllocateFromLargeFreeList(size_t requested_size)
void AddOrCoalesceFreeList(const MemoryRegion current, const MemoryRegion previous, const MemoryRegion next, const MemoryRegion coalesced)
void * AllocateRawPointer(size_t requested_size)
void DisposeRawPointer(void *definitely_pointer)
FreeList::iterator FindExactRegion(FreeList &free_list, const MemoryRegion region)
void * TryAllocateFromFreeList(size_t requested_size)
absl::btree_multiset< MemoryRegion, MemoryRegion::SetCompare > FreeList
void AddOrCoalesceLargeFreeList(const MemoryRegion current, const MemoryRegion previous, const MemoryRegion next, const MemoryRegion coalesced)
virtual void Dispose(void *definitely_uintptr) override
static constexpr size_t MaximumAllocationSize()
void * SplitFreeListEntry(FreeList &free_list, FreeList::iterator &pos, size_t requested_size)
virtual const void * GetBasePointerOfMaybeInnerPointer(const void *maybe_inner) const override
void * TryAllocateFromFreeListImpl(FreeList &free_list, size_t requested_size)
std::vector< MemorySpace > large_spaces_
UintPtr Allocate(size_t size)
#define BASSERT(x, m,...)
#define BASSERT_GE(lhs, rhs, m,...)
#define BASSERT_LE(lhs, rhs, m,...)
#define BENSURE(x, m,...)
#define BDEBUG_LOG(m,...)
#define BASSERT_NE(lhs, rhs, m,...)
#define BASSERT_LT(lhs, rhs, m,...)
#define BENSURE_NE(lhs, rhs, m,...)
#define BASSERT_SLOW(x, m,...)
constexpr const int kPointerSize
constexpr const uintptr_t kNullUintPtr
std::queue< T, broom::deque< T > > queue
size_t total_mapped_bytes