fix flatmap element space should align with usertype #2288
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number:
Problem Summary:
FlatMap
中Bucket
的Element
用于存放用户的 key 和 value,初始化 element 的空间(element_space
) 地址要满足 Element 的对齐要求。未修改前,可以看到 element_space 的起始地值,并未满足 Element 的对齐要求:
一些编译器在开启优化选项后,会根据数据的对齐字节,而选择更高效的指令,例如
movaps
, 如果实际的数据未按照其对齐要求分配内存,则会导致错误发生。What is changed and the side effects?
Changed:
采用
std::aligned_storage<sizeof(Element), alignof(Element)>
用于初始化element_space
.Side effects:
无
无
Check List: