Modify heuristic for adding new slabs. (#429)
If there is only one slab remaining, then we probabalisticly allocator a new one. If a slab is barely in use, then this could cause us to effectively double the number of slabs in use. This commit checks if the remaining slab has enough remaining elements to provide randomisation.
This commit is contained in:
committed by
GitHub
parent
c299826f58
commit
5fd3288997
@@ -159,5 +159,13 @@ namespace snmalloc
|
||||
v.end = &(item->next);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek at next element in the set.
|
||||
*/
|
||||
SNMALLOC_FAST_PATH const T* peek()
|
||||
{
|
||||
return v.head;
|
||||
}
|
||||
};
|
||||
} // namespace snmalloc
|
||||
|
||||
Reference in New Issue
Block a user