Boost C++ Libraries: Ticket #676: Shmem serious bugs https://svn.boost.org/trac10/ticket/676 <pre class="wiki">Hi, these are the 2 things I have found so far using the shmem lib. My understading is that this is not yet a boost library but it has been accepted to become one in the near future. Accept my apologies if I shouldn´t had posted here. 1) If you try to use a node allocator with a fixed_named_shared_object it won't compile. Works fine for non fixed segments. 2) If you concatenate with the '+=' operator a boost::string with a NULL terminated str (char *) in a loop up to N times, you get bad_alloc sooner than if you do a single allocation of the same lenght of the N previous allocations. So concatenating is wasting memory somehow, as you can allocate longer strings with a single allocation than with N equivalent concatenations. Thanks. (bblasi at jblasi dot com) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/676 Trac 1.4.3 nobody Tue, 30 Jan 2007 16:50:11 GMT <link>https://svn.boost.org/trac10/ticket/676#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/676#comment:1</guid> <description> <pre class="wiki">Logged In: NO The second is not a bug, it's normal. If you allocate memory step by step, you will end fragmenting the memory and the memory manager is not going to find a big enough memory chunk to request your need. For example, if you have an string placed in the first bytes of a segment: [XXXXXXXXXXXXXXXXXXXXXXXXXXXXX.........................] If you do incremental assignment, since Shmem has no memory expansion features (it can expand your current buffer, only can allocate a bigger one), you won't be able to allocate an string bigger than the half of the segment. On the other hand you can take an empty string, and assign an string with the full size of the segment because there is only one allocation involved. The same happens with common standard string implementations, the difference is that shared memory is much more limited in space than the heap. Memory expansion features for vectors and string were implemented in Boost.Interprocess. I will try to investigate what's happening with fixed_named_shared_object and node_allocator. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Fri, 06 Apr 2007 21:00:54 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/676#comment:2 https://svn.boost.org/trac10/ticket/676#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=1416985 Originator: NO I have no time to spend on Shmem, so I'll close this bug. Please use Interprocess (which is the official Boost library, Shmem is not really a boost library). </pre> Ticket