Subject: [Boost-bugs] [Boost C++ Libraries] #7295: mapped_region large file throw exception
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-08-27 09:09:08
#7295: mapped_region large file throw exception
-----------------------+----------------------------------------------------
Reporter: anonymous | Type: Bugs
Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.52.0
Severity: Problem | Keywords:
-----------------------+----------------------------------------------------
using namespace boost::interprocess;
const std::size_t FileSize = 10000000000;
//if(argc == 1)
{ //Parent process executes this
{ //Create a file
std::filebuf fbuf;
fbuf.open("e:\\output\\file.bin",
std::ios_base::in | std::ios_base::out
| std::ios_base::trunc |
std::ios_base::binary);
//Set the size
fbuf.pubseekoff(FileSize-1, std::ios_base::beg);
fbuf.sputc(0);
}
//Remove file on exit
struct file_remove
{
~file_remove (){
file_mapping::remove("file.bin"); }
} destroy_on_exit;
//Create a file mapping
file_mapping m_file("e:\\output\\file.bin", read_write);
//Map the whole file with read-write permissions in this
process
try{
mapped_region region(m_file, read_write);
//Get the address of the mapped region
void * addr = region.get_address();
std::size_t size = region.get_size();
//Write all the memory to 1
std::memset(addr, 1, size);
}
catch( boost::interprocess::interprocess_exception& ex ){
cout << "\njjhhh" << ex.what() << endl;
}
//Launch child process
//std::string s(argv[0]); s += " child ";
// if(0 != std::system(s.c_str()))
return 1;
}
mapped_region region(m_file, read_write); throw a exception
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7295> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC