August 24th, 2009, 06:31 AM
Creating a boost’s managed_mapped_file
I am trying to create a (fixed size) managed_mapped_file for storing a table. The table contains a certain number of elements[n] of a certain size [k] (therefore table’s size is n*k) the required size which I would like to use is n*k (size of element * number of elements).
When boost’s managed file is created [new bip::managed_mapped_file (bip::create_only, fileName, n*k);] besides the elements which I would like to place in this file, boost’s segment manager is also placed there and occupies space of uncertain size. [http://www.boost.org/doc/libs/1%5F39...%5Fmanaged%5D]. I would like to know how much memory (size of file) shall I require in the C-tor so that my file will have enough space for n elements of size k, and be as compact as possible.
The trivial/none-elegant way to solve this is to allocate 10% memory more than I need on the disk, from functionality point of view this works but I hate it.
I already asked this question in a few other places but none answered me. Please advise.
10x in advance.
September 1st, 2009, 04:09 AM
Re: Creating a boost’s managed_mapped_file
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.