Commit edc1a240 authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

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.
parent 53a25406
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -195,8 +195,8 @@ sl_new(pool *p, uint size)
{
  slab *s = ralloc(p, &sl_class);
  uint align = sizeof(struct sl_alignment);
  if (align < sizeof(int))
    align = sizeof(int);
  if (align < sizeof(void *))
    align = sizeof(void *);
  s->data_size = size;
  size = (size + align - 1) / align * align;
  s->obj_size = size;