Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::interprocess:basic_string : Capacity no more than 10
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-07-29 20:34:29


samuel.gallard escribió:
> Hello,
>
> I first present to you my code and I will explain my problem with the code .

First of all, you can't use virtual functions in shared memory, this is
explained in the documentation

"Limitations When Constructing Objects In Mapped Regions"

http://www.boost.org/doc/libs/1_39_0/doc/html/interprocess/sharedmemorybetweenprocesses.html#interprocess.sharedmemorybetweenprocesses.mapped_region_object_limitations

the 10 limit is probably because string has an internal buffer before
dynamically allocating anything (an optimization known as Small String
Optimization). Everytying is write until you try to allocate memory

See "doc_cont.cpp" example to see how containers (and strings) are
placed in shared memory.

Best,

Ion


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