Boost C++ Libraries: Ticket #3349: ordered_malloc not always keeps the free list ordered. https://svn.boost.org/trac10/ticket/3349 <p> Hello, </p> <p> In function </p> <pre class="wiki">template &lt;typename UserAllocator&gt; void * pool&lt;UserAllocator&gt;::ordered_malloc(const size_type n) </pre><p> in pool.hpp, I saw the code below along with the comments: </p> <pre class="wiki">// Split up block so we can use what wasn't requested // (we can use "add_block" here because we know that // the free list is empty, so we don't have to use // the slower ordered version) if (next_size &gt; num_chunks) store().add_block(node.begin() + num_chunks * partition_size, node.element_size() - num_chunks * partition_size, partition_size); </pre><p> However, here I don't see why the free list must be empty. In my case, the free list is not empty. The new free chunks are added to the beginning of the free list and all existing ones are appended to the new ones, making the list out of order. </p> <p> I guess using ordered_add_block could easily solve this problem. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3349 Trac 1.4.3 Xiaohan Wang <wangxiaohan@…> Mon, 17 Aug 2009 21:56:28 GMT <link>https://svn.boost.org/trac10/ticket/3349#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3349#comment:1</guid> <description> <p> BTW, I wrote a simple program to show this. The variable "any_memory_released" is false after the release because the free list is out of order. If we change the "add_block" to "add_ordered_block" then "any_memory_released" is true. </p> <pre class="wiki">int main() { pool&lt;&gt; p(256, 4); void* pBlock1 = p.ordered_malloc( 1 ); void* pBlock2 = p.ordered_malloc( 4 ); p.ordered_free( pBlock1 ); bool any_memory_released = p.release_memory(); cout &lt;&lt; "Any memory released? " &lt;&lt; any_memory_released &lt;&lt; endl; } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Fri, 07 Jan 2011 11:21:33 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/3349#comment:2 https://svn.boost.org/trac10/ticket/3349#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">boostpool@…</span> added </li> </ul> Ticket anonymous Tue, 11 Jan 2011 22:53:25 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3349#comment:3 https://svn.boost.org/trac10/ticket/3349#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This was fixed as part of <a class="changeset" href="https://svn.boost.org/trac10/changeset/67792" title="Merging fixes to release; fixes #2294 fixes #4918 fixes #3645 refs ...">[67792]</a> </p> Ticket