Skip to content
Snippets Groups Projects
  • Vladislav Shpilevoy's avatar
    ea6b814e
    region: use aligned allocations where necessary · ea6b814e
    Vladislav Shpilevoy authored
    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
    ea6b814e
    History
    region: use aligned allocations where necessary
    Vladislav Shpilevoy authored
    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