зеркало из https://github.com/microsoft/snmalloc.git
Remove union in metaslab
The union in Metaslab provides no benefit in size, as the single byte it effectively saves will be removed due to padding. By removing the union, we get stronger properties over sizeclass, and remove an out-of-bounds access.
This commit is contained in:
Родитель
dc19b5ace2
Коммит
94f8b886a0
|
@ -57,11 +57,8 @@ namespace snmalloc
|
|||
// doubly linked node into that size class's free list.
|
||||
uint16_t link;
|
||||
|
||||
union
|
||||
{
|
||||
uint8_t sizeclass;
|
||||
uint8_t next;
|
||||
};
|
||||
uint8_t sizeclass;
|
||||
uint8_t next;
|
||||
|
||||
void add_use()
|
||||
{
|
||||
|
|
|
@ -194,6 +194,7 @@ namespace snmalloc
|
|||
uint8_t index = (uint8_t)slab_to_index(slab);
|
||||
uint8_t n = head - index - 1;
|
||||
|
||||
meta[index].sizeclass = 0;
|
||||
meta[index].next = n;
|
||||
head = index;
|
||||
bool was_almost_full = is_almost_full();
|
||||
|
|
Загрузка…
Ссылка в новой задаче