On 02/08/2018 11:31, Zhiming Wang via Boost-users wrote:
Hi,
I am using boost 1.65.1 interprocess lib, and tried to construct a string that is safe to store in a managed_shared_memory.
Types are defined as below:
using namespace boost::interprocess; using ShmSegment_t = boost::interprocess::managed_shared_memory; using SegmentMgr_t = boost::interprocess::managed_shared_memory::segment_manager; template <typename T> using Allocator_t = boost::interprocess::allocator
; using String_t = boost::interprocess::basic_string
; Code in problem is as below:
using namespace boost::interprocess; ShmSegment_t segment(open_or_create, "Test", 1L << 31); const std::string stdStr("std_str"); String_t ipcStr( stdStr.c_str(), segment.get_segment_manager()); *// oops, crashed! *
Are you are reserving 2GB of memory? Do you have enough memory in your system? Linux overcommits by default. Best, Ion