Lib: Update alignment of slabs
Alignment of slabs should be at least sizeof(ptr) to avoid unaligned pointers in slab structures. Fixme: Use proper way to choose alignment for internal allocators.
This commit is contained in:
parent
53a2540687
commit
edc1a24017
1 changed files with 2 additions and 2 deletions
|
@ -195,8 +195,8 @@ sl_new(pool *p, uint size)
|
||||||
{
|
{
|
||||||
slab *s = ralloc(p, &sl_class);
|
slab *s = ralloc(p, &sl_class);
|
||||||
uint align = sizeof(struct sl_alignment);
|
uint align = sizeof(struct sl_alignment);
|
||||||
if (align < sizeof(int))
|
if (align < sizeof(void *))
|
||||||
align = sizeof(int);
|
align = sizeof(void *);
|
||||||
s->data_size = size;
|
s->data_size = size;
|
||||||
size = (size + align - 1) / align * align;
|
size = (size + align - 1) / align * align;
|
||||||
s->obj_size = size;
|
s->obj_size = size;
|
||||||
|
|
Loading…
Reference in a new issue