diff --git a/libc/src/__support/freelist_heap.h b/libc/src/__support/freelist_heap.h index 463ac6a1fd59117..ee448c04cfb2271 100644 --- a/libc/src/__support/freelist_heap.h +++ b/libc/src/__support/freelist_heap.h @@ -51,13 +51,10 @@ template class FreeListHeap { }; constexpr FreeListHeap() - : is_initialized_(false), region_(&_end, size_t{0}), - heap_limit_(&__libc_heap_limit), freelist_(DEFAULT_BUCKETS), - heap_stats_{} {} + : region_(&_end, size_t{0}), heap_limit_(&__libc_heap_limit) {} constexpr FreeListHeap(span region) - : is_initialized_(false), region_(region), heap_limit_{}, - freelist_(DEFAULT_BUCKETS), heap_stats_{} { + : region_(region), heap_limit_{} { heap_stats_.total_bytes = region.size(); } @@ -86,14 +83,14 @@ template class FreeListHeap { return ptr >= region_.begin() && ptr < region_.end(); } - bool is_initialized_; + bool is_initialized_ = false; cpp::span region_; // Kept to initialize region_ by non-constexpr cast to size_t cpp::byte *heap_limit_; - FreeListType freelist_; - HeapStats heap_stats_; + FreeListType freelist_{DEFAULT_BUCKETS}; + HeapStats heap_stats_{}; }; template