Boost logo

Boost Users :

Subject: Re: [Boost-users] boost interprocess / shared memory question
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-02-14 18:02:54


On Fri, Feb 13, 2009 at 2:03 PM, Naveen Santhanam <naveen_at_[hidden]> wrote:
> Hello,
>
>
>
> We have a windows application (a process) that requires a large data file
> (approx. 100 MB) to perform a task. We have a master that launches several
> instances of this application. We would like to share the large data file
> across the processes such that, there is just one instance of the data file
> in physical memory without any disc access. Hence each application will have
> a small footprint in memory during execution. We have tried using a managed
> shared memory object from the boost::interprocess library to achieve this.
> However, this doesn't help us as the memory footprint of the application
> goes up upon access of the data file. Is there a way to achieve the desired
> single footprint memory sharing? Does this work as expected with other
> OSes?

Just mapping the file to memory in windows will do what you want.
Boost.Interprocess has a wrapper you can put around a section of
memory that you have mapped, but you do not need it for this, just map
it yourself and access it like normal memory. The Boost.Interprocess
wrapper makes accessing it more consistent though, especially if you
intend to port to other OSes as well.. The memory usage will be
reported as much higher for each program, but that whole file of each
app will be shared, regardless what the task manager reports.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net