boost
boost copied to clipboard
Alignment problem with boost/interprocess/segment_manager on SPARC 32Bit / Boost 1.84
As requested by @igaztanaga on https://cpplang.slack.com/archives/C27KZLB0X/p1710326590253599 I'm opening an issue here.
I'm creating a shared memory:
TEST(SharedMemoryManagerTest, PlainTest) {
struct TestData {
std::chrono::time_point<std::chrono::steady_clock> c1{};
std::chrono::time_point<std::chrono::steady_clock> c2{};
uint32_t data;
};
auto unnamedRegion = std::make_unique<boost::interprocess::mapped_region>(
boost::interprocess::anonymous_shared_memory(512*1024));
auto anonymousShm = std::make_unique<boost::interprocess::managed_external_buffer>(
boost::interprocess::create_only, unnamedRegion->get_address(), unnamedRegion->get_size());
auto result = anonymousShm->find_or_construct<TestData>("test"); //kaboom
ASSERT_NE(nullptr, result.operator()());
}
That is the output:
[----------] 1 test from SharedMemoryManagerTest
[ RUN ] SharedMemoryManagerTest.PlainTest
Start foo: SharedMemoryManagerTest.PlainTest
Test #foo: SharedMemoryManagerTest.PlainTest
.............................................................................Bus error***Exception: 1.28 sec
Tested on other platforms x86, 32&64Bit (Win/Linux) without any issues.
I thought it might be due to segment_manager.hpp priv_generic_named_construct(...) there is an allocate performed and not allocate_aligned despite having the info in block_info.m_value_alignment available.