From: Shibu Bera (shibu.ncst_at_[hidden])
Date: 2007-03-08 23:38:57
Thanks Lon for the nice reply. I hope I will get a new method very soon.
I have one more query about the shared memory.
I create shared memory using boost::interprocess, at linking time I add
-lrt -lxml2 -lccext2 -lccgnu2 -ldl (common C++ link library) along with
-Wall -pedantic -g -pthread -DBOOST_DATE_TIME_NO_LIB
-DBOOST_INTERPROCESS_POSIX_PROCESS_SHARED -lstdc++ -lboost_thread
(boost::interprocess link library).
The common C++ library is added for the other requirement of the
I open the shared memory form the another process, where "comman C++ link
library" is not added. Segmentation fault is the result.
Then I created two shared memory.
First with "common C++ link library" and "boost::interprocess link library"
Second with only "boost::interprocess link library",
These two shared memories are different, I found offset of some bytes on the
actual values stored in the shared memory. I am not finding the way, why
this problem is. I want to know how any other link libray may change the
data of the shared memory. Please help.
On 3/8/07, Ion Gaztañaga <igaztanaga_at_[hidden]> wrote:
> Shibu Bera wrote:
> > Hi,
> > After creating the shared memory I put three containers
> > std::map and std::vector) into the shared memory, then objects into the
> > containers. But in later part of the execution, there are condition when
> > need to remove these elements and containers. I also don't want to eat
> > the primary memory by creating the saparate shared memory nor I want to
> > remove the earlier shared memory. If I just destroy the containers the
> > previous garbage data may create problem. So I want such method or way
> > memset the shared memory with NULL characters. This information should
> > suffice the query, Can I get some clue now?
> Which type of problems, security problems? Or do you base your program
> on the value the memory you allocate has before using it? If your
> destroy the containers and after that you create new ones, I think you
> shouldn't have problems. If for any reason, (security or whatever) you
> need to guarantee that all free memory (memory that does not contain any
> object in the segment) is zeroed before being reused, I would need to
> add new functionality to the library, because this is not currently
> possible: the memory allocation algorithm should have a function that
> traverses all the free memory segments and memsets them.
> These days I will be busy with the Intrusive review, so you would need
> to wait until the end of the month to get this functionality.
> Unsubscribe & other changes:
-- Regards, CBu..., Tata Power, Mumbai.......
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk