Problem with boost ::interprocess::string

On Thursday, December 22, 2011 11:42 AM, Josmon Paul wrote:
Hi All I am totally new to the boost library. i will start with my problem. Currently i am using boost shared memory for storing a vector list. In the vector list each elements are string type. I am using boost::interprocess::string type. But i was not able to use the string size of more than 10 as above it is causing segmentation fault. If it is below 10 there is no issues. Pleasehelp me how to fix this issue.
By default, boost::interprocess::string uses the standard (non-interprocess) allocator. Below 10 characters, the string doesn't allocate any additional storage; it stores the string in the string object itself. Beyond 10 characters, it allocates a buffer to store the string.
If you're storing the string in a shared region (which I assume you are), you need to use the following string type:
boost::interprocess::basic_string

El 22/12/2011 17:42, Josmon Paul escribió:
Hi All I am totally new to the boost library. i will start with my problem. Currently i am using boost shared memory for storing a vector list. In the vector list each elements are string type. I am using boost::interprocess::string type. But i was not able to use the string size of more than 10 as above it is causing segmentation fault. If it is below 10 there is no issues. Pleasehelp me how to fix this issue.
Ti see how to allocate something "complex" like a vector of strings, please see documentation: http://www.boost.org/doc/libs/1_48_0/doc/html/interprocess/allocators_contai... Best, Ion
participants (3)
-
Andrew Holden
-
Ion Gaztañaga
-
Josmon Paul