Boost C++ Libraries: Ticket #7295: mapped_region large file throw exception https://svn.boost.org/trac10/ticket/7295 <p> using namespace boost::interprocess; </p> <blockquote> <p> const std::size_t <a class="missing wiki">FileSize</a> = 10000000000; <em>if(argc == 1) { </em>Parent process executes this </p> <blockquote> <p> { <em>Create a file </em></p> <blockquote> <p> std::filebuf fbuf; fbuf.open("e:<br />output<br />file.bin", std::ios_base::in | std::ios_base::out </p> <blockquote> <p> | std::ios_base::trunc | std::ios_base::binary); </p> </blockquote> <p> <em>Set the size fbuf.pubseekoff(<a class="missing wiki">FileSize</a>-1, std::ios_base::beg); fbuf.sputc(0); </em></p> </blockquote> <p> } <em>Remove file on exit struct file_remove { </em></p> <blockquote> <p> ~file_remove (){ file_mapping::remove("file.bin"); } </p> </blockquote> <p> } destroy_on_exit; </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>Create a file mapping file_mapping m_file("e:<br />output<br />file.bin", read_write); </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>Map the whole file with read-write permissions in this process try{ mapped_region region(m_file, read_write); </em></p> </blockquote> </blockquote> <p> </p> <blockquote> <blockquote> <p> <em>Get the address of the mapped region void * addr = region.get_address(); std::size_t size = region.get_size(); </em></p> </blockquote> </blockquote> <blockquote> <blockquote> <p> <em>Write all the memory to 1 std::memset(addr, 1, size); } catch( boost::interprocess::interprocess_exception&amp; ex ){ </em></p> <blockquote> <p> cout &lt;&lt; "\njjhhh" &lt;&lt; ex.what() &lt;&lt; endl; </p> </blockquote> <p> } <em>Launch child process </em>std::string s(argv<a class="missing changeset" title="No changeset 0 in the repository">[0]</a>); s += " child "; </p> </blockquote> <p> <em> if(0 != std::system(s.c_str())) </em></p> <blockquote> <blockquote> <p> return 1; </p> </blockquote> </blockquote> <p> } </p> </blockquote> <p> mapped_region region(m_file, read_write); throw a exception </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7295 Trac 1.4.3 viboes Tue, 18 Sep 2012 16:59:13 GMT component changed; owner set https://svn.boost.org/trac10/ticket/7295#comment:1 https://svn.boost.org/trac10/ticket/7295#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Ion Gaztañaga</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">interprocess</span> </li> </ul> Ticket Ion Gaztañaga Tue, 18 Sep 2012 21:36:24 GMT <link>https://svn.boost.org/trac10/ticket/7295#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7295#comment:2</guid> <description> <p> Thanks for the report. In which system are you trying this? 32/64 bit windows/linux/unix? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Tue, 18 Sep 2012 21:37:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7295#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7295#comment:3</guid> <description> <p> And you specified 1.52 which does not exist yet. Could you provide the correct Boost version? Thanks. </p> </description> <category>Ticket</category> </item> </channel> </rss>