tarantool / small

Specialized memory allocators
Other
102 stars 22 forks source link

slab cache: fix slab alignment to 16 bytes #95

Closed nshy closed 2 months ago

nshy commented 2 months ago

It was 8 bytes by mistake. We should align slabs as malloc at least ie the pointer should be suitable to store any type.

Before the change the newly added test failed:

# *** test_slab_alignment ***

/home/shiny/dev/tarantool/src/lib/small/test/slab_cache.c:134:2: runtime error: store to misaligned address 0x521000001528 for type 'long double', which requires 16 byte alignment 0x521000001528: note: pointer points here be be 20 00 00 10 00 00 00 00 00 00 be be be be be be be be be be be be be be be be be be be be ^ SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/shiny/dev/tarantool/src/lib/small/test/slab_cache.c:134:2 in

PR with bump https://github.com/tarantool/tarantool/pull/10570