[Tarantool-patches] [PATCH 05/10] sql: make BtCursor's memory aligned
Cyrill Gorcunov
gorcunov at gmail.com
Mon Jun 8 16:58:57 MSK 2020
On Thu, May 21, 2020 at 10:37:28PM +0200, Vladislav Shpilevoy wrote:
> Vdbe at runtime allocates VdbeCursor structure using
> allocateCursor() function. Inside there is a pointer at BtCursor
> structure. To make the allocation faster and improve cache
> locality, both cursors are allocated in one memory block + some
> extra memory for uint32_t array, where BtCursor followed
> VdbeCursor and the array without any padding:
>
> VdbeCursor + uint32_t * N + BtCursor
>
> The problem is that BtCursor needs 8 byte alignment. When it
> followed VdbeCursor (aligned by 8) + some uint32_t values, its
> actual alignment could become 4 bytes. That led to a crash when
> alignment sanitizer is enabled in clang.
>
> The patch makes BtCursor offset aligned by 8 bytes.
>
> Part of #4609
Reviewed-by: Cyrill Gorcunov <gorcunov at gmail.com>
More information about the Tarantool-patches
mailing list