开发者

Shared memory and strings: managed?

开发者 https://www.devze.com 2022-12-17 03:25 出处:网络
I have a problem with boost::interprocess::string in shared memory. When I use a shared_memory_object I can manip开发者_运维技巧ulate a structure with different fields, BUT strings (I get a segmentat

I have a problem with boost::interprocess::string in shared memory.

When I use a shared_memory_object I can manip开发者_运维技巧ulate a structure with different fields, BUT strings (I get a segmentation fault).

On the other side, when I use managed_shared_memory everything is fine.

Am I doing something wrong? Do you know if there is a performance penalty using managed_shared_memory?

Thank you!


For using strings in boost interprocess, see this question.

As for performance, it should be better than most other solution - this is the reason it exists - to share memory between processes. Every other method to share data between process would have an overhead that shared memory don't need (packet header + IO for TCP, DB round trips for DB, etc.)

0

精彩评论

暂无评论...
验证码 换一张
取 消