[libc-commits] [libc] [libc] Lazily initialize freelist malloc using symbols (PR #99254)
via libc-commits
libc-commits at lists.llvm.org
Wed Jul 17 14:48:09 PDT 2024
================
@@ -47,17 +50,10 @@ template <size_t NUM_BUCKETS = DEFAULT_BUCKETS.size()> class FreeListHeap {
size_t total_free_calls;
};
- FreeListHeap(span<cpp::byte> region)
- : FreeListHeap(&*region.begin(), &*region.end(), region.size()) {
- auto result = BlockType::init(region);
- BlockType *block = *result;
- freelist_.add_chunk(block_to_span(block));
- }
-
- constexpr FreeListHeap(void *start, cpp::byte *end, size_t total_bytes)
- : block_region_start_(start), block_region_end_(end),
- freelist_(DEFAULT_BUCKETS), heap_stats_{} {
- heap_stats_.total_bytes = total_bytes;
+ constexpr FreeListHeap(span<cpp::byte> region)
+ : is_initialized_(false), region_(region), freelist_(DEFAULT_BUCKETS),
----------------
PiJoules wrote:
Not sure if I'm overthinking this, but are these guaranteed to be link-initialized to their default values for the global in freelist_malloc.cpp?
https://github.com/llvm/llvm-project/pull/99254
More information about the libc-commits
mailing list