Saturday 31 August 2013

File size limit for boost memory mapped files?

File size limit for boost memory mapped files?

I am using the below code to open files which are approximately 400 to
800MB in size:
#include <boost\interprocess\file_mapping.hpp>
#include <boost\interprocess\mapped_region.hpp>
#include <iostream>
#include <vector>
#include <string>
using namespace boost::interprocess;
using namespace std;
int main(){
file_mapping fm("C:\\test\\1.txt",read_only);
mapped_region region(fm,read_only);
const char* const data = static_cast<const char*>(region.get_address());
const size_t max_size = region.get_size();
cout << max_size;
int b;
cin >> b;
}
If I point the above code to a small file I get no exception. However,
when looking at the several-hundred-MB-files (on an external USB) I get an
exception:
Unhandled exception at at 0x7521C41F in ReadingFiles.exe: Microsoft C++
exception: boost::interprocess::interprocess_exception at memory location
0x0040FBD4.
I have 2.4GB of RAM free- so it shouldnt be that I have run out of memory?

No comments:

Post a Comment