Boost C++ Libraries: Ticket #11724: managed_shared_memory constructor crash https://svn.boost.org/trac10/ticket/11724 <p> If my system has zero shared memory available and I invoke the managed_shared_memory constructor, the constructor will crash. I am able to consistently reproduce this on Centos 6.5 using g++ 4.4.7 and Boost v1.59. </p> <p> My repro case is very Linux-specific: 1: rm /dev/shm/foobar 2: dd if=/dev/zero of=/dev/shm/fill (the command will terminate once all shared memory on the system is exhausted) 3: Build the attached C++ file (I used g++ -g -I/path/to/boost/ -lpthread -lrt shm.cpp) 4: Run the resulting executable, it should crash </p> <pre class="wiki">(gdb) where #0 0x0000000000402186 in boost::interprocess::ipcdetail::atomic_cas32 (mem=0x7ffff7ee3000, with=1, cmp=0) at /home/elemental/boost_1_5_9/boost_1_59_0/boost/interprocess/detail/atomic.hpp:141 #1 0x000000000040389c in boost::interprocess::ipcdetail::managed_open_or_create_impl&lt;boost::interprocess::shared_memory_object, 16ul, true, false&gt;::priv_open_or_create&lt;boost::interprocess::ipcdetail::create_open_func&lt;boost::interprocess: :ipcdetail::basic_managed_memory_impl&lt;char, boost::interprocess::rbtree_best_fit&lt;boost::interprocess::mutex_family, boost::interprocess::offset_ptr&lt;void, long, unsigned long, 0u&gt;, 0ul&gt;, boost::interprocess::iset_index, 16ul&gt; &gt; &gt; (this= 0x7fffffffe0f8, type=boost::interprocess::ipcdetail::DoCreate, id=@0x7fffffffe090, size=1048576, mode=boost::interprocess::read_write, addr=0x0, perm=..., construct_func=...) at /home/elemental/boost_1_5_9/boost_1_59_0/boost/interprocess/detail/managed_open_or_create_impl.hpp:409 #2 0x0000000000403163 in boost::interprocess::ipcdetail::managed_open_or_create_impl&lt;boost::interprocess::shared_memory_object, 16ul, true, false&gt;::managed_open_or_create_impl&lt;boost::interprocess::ipcdetail::create_open_func&lt;boost::inter process::ipcdetail::basic_managed_memory_impl&lt;char, boost::interprocess::rbtree_best_fit&lt;boost::interprocess::mutex_family, boost::interprocess::offset_ptr&lt;void, long, unsigned long, 0u&gt;, 0ul&gt;, boost::interprocess::iset_index, 16ul&gt; &gt; &gt; (this=0x7fffffffe0f8, id=@0x7fffffffe090, size=1048576, mode=boost::interprocess::read_write, addr=0x0, construct_func=..., perm=...) at /home/elemental/boost_1_5_9/boost_1_59_0/boost/interprocess/detail/managed_open_or_create_impl.hpp:184 #3 0x0000000000402f2b in boost::interprocess::basic_managed_shared_memory&lt;char, boost::interprocess::rbtree_best_fit&lt;boost::interprocess::mutex_family, boost::interprocess::offset_ptr&lt;void, long, unsigned long, 0u&gt;, 0ul&gt;, boost::interprocess::iset_index&gt;::basic_managed_shared_memory (this=0x7fffffffe0f0, name=0x4077fb "foobar", size=1048576, addr=0x0, perm=...) at /home/elemental/boost_1_5_9/boost_1_59_0/boost/interprocess/managed_shared_memory.hpp:106 #4 0x00000000004016a2 in main (argc=1, argv=0x7fffffffe228) at shm.cpp:23 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11724 Trac 1.4.3 john.saxton@… Tue, 13 Oct 2015 20:23:28 GMT attachment set https://svn.boost.org/trac10/ticket/11724 https://svn.boost.org/trac10/ticket/11724 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">shm.cpp</span> </li> </ul> <p> Repro of bug <a class="new ticket" href="https://svn.boost.org/trac10/ticket/11724" title="#11724: Bugs: managed_shared_memory constructor crash (new)">#11724</a> </p> Ticket