Open billzheng opened 4 months ago
Minified and extrapolating for analysis: https://godbolt.org/z/Eh4K7hnKE
#include <boost/interprocess/managed_heap_memory.hpp>
namespace bip = boost::interprocess;
using Seg = bip::basic_managed_heap_memory<char, //
bip::rbtree_best_fit<bip::mutex_family, bip::offset_ptr<void>, 64>,
bip::iset_index>;
struct alignas(64) T { int arr[1000]; };
static void test(auto key) { Seg(10240).construct<T>(key)(); }
int main() {
test(bip::anonymous_instance); // OKAY
test(bip::unique_instance); // Not OKAY
test("data"); // Not OKAY
}
Printing
boost/interprocess/detail/named_proxy.hpp:90:49: runtime error: constructor call on misaligned address 0x526000000298 for type 'T', which requires 64 byte alignment
0x526000000298: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /boost/interprocess/detail/named_proxy.hpp:90:49 in
I might have time to look closer later.