[Tarantool-patches] [PATCH 06/10] region: use aligned allocations where necessary
Cyrill Gorcunov
gorcunov at gmail.com
Mon Jun 8 17:00:46 MSK 2020
On Thu, May 21, 2020 at 10:37:29PM +0200, Vladislav Shpilevoy wrote:
> Region is used for temporary allocations, usually bound to a
> transaction, but not always. Keyword - temporary. It is usually
> much faster to allocate something on the region than on the heap,
> and much much faster to free the region, since it frees data in
> whole slabs. Lots of objects at once.
>
> Region is used both for byte arrays (MessagePack, strings, blobs),
> and for objects like standard types, structs. Almost always for
> allocations was used region_alloc() function, which returns a not
> aligned address. It can be anything, even not multiple of 2.
>
> That led to alignment violation for standard types and structs.
> Usually it is harmless in terms of errors, but can be slower than
> aligned access, and on some platforms may even crash. Also the
> crash can be forced using clang undefined behaviour sanitizer,
> which revealed all the not aligned accesses fixed in this patch.
>
> Part of #4609
Reviewed-by: Cyrill Gorcunov <gorcunov at gmail.com>
More information about the Tarantool-patches
mailing list