I've spent some time investigating memory mapped IO for an application I'm working on. I have some very large (TB scale) files, and I want to map segments from them into memory, for both reading and writing, making maximum use of OS-level caching. The software I'm writing needs to work under Unix/Linux and Windows... performance is critical.
I've discovered boost::iostreams::mapped_file_source
and boost::iostreams::mapped_file_sink
, which provide most of the facilities I'm looking for. The facilities I'd like, but haven't found are:
msync
(2) on Unix; FlushViewOfFile
on Windows)Can I do these things using "boost/iostreams/device/mapped_file.hpp"
? Are there other platform independent libraries that would better suit my requirements? Must I develop my own cross-platform library to get this flexibility?
Look at boost::interprocess and boost::interprocess::file_mapping. They have everything you need.
boost::interprocess
boost::interprocess::file_mapping
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With