-
Type: Task
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
-
Service Arch
-
v8.0
-
Service Arch 2024-04-15, Service Arch 2024-04-29
Premise
We use 128-bit types in the BSONColumnBuilder. On x86, we need 128-bit types to be 16-byte aligned (a couple of sources: 1, 2, 3, 4). Separately, we overload operator new in the TrackingAllocator.
Problematic Change
We set {}STDCPP_DEFAULT_NEW_ALIGNMENT{} (C++17 macro) to 8 bytes instead of 16 to make TCMalloc faster. Setting this macro causes operator new/delete to align to 8 bytes instead of 16 bytes (malloc is still 16). This causes segfaults when dealing with 128-bit types on x86 due to misaligned access (other examples of failure in the wild: 1, 2, 3).
Proposed Solution
Force the TrackingAllocator to use aligned_alloc and pass in alignof(T), since abseil int128 types are already indicated to align to 16 bytes.