Opened 10 years ago

Last modified 10 years ago

#7295 new Bugs

mapped_region large file throw exception

Reported by: anonymous Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

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

Change History (3)

comment:1 by viboes, 10 years ago

Component: Noneinterprocess
Owner: set to Ion Gaztañaga

comment:2 by Ion Gaztañaga, 10 years ago

Thanks for the report. In which system are you trying this? 32/64 bit windows/linux/unix?

comment:3 by Ion Gaztañaga, 10 years ago

And you specified 1.52 which does not exist yet. Could you provide the correct Boost version? Thanks.

Note: See TracTickets for help on using tickets.