Rework free list so that 0 is the placeholder.
This is needed because in some configurations the constructor for the global placeholder is not called before the first allocation (i.e. when other globals call the allocator in their constructor) and so we ended up following a null pointer.
This commit is contained in:
@@ -1072,7 +1072,7 @@ namespace snmalloc
|
||||
assert(sizeclass < NUM_SMALL_CLASSES);
|
||||
auto& fl = small_fast_free_lists[sizeclass];
|
||||
auto head = fl.value;
|
||||
if (likely((reinterpret_cast<size_t>(head) & 1) == 0))
|
||||
if (likely(head != nullptr))
|
||||
{
|
||||
void* p = head;
|
||||
// Read the next slot from the memory that's about to be allocated.
|
||||
|
||||
Reference in New Issue
Block a user