Subject: [Boost-bugs] [Boost C++ Libraries] #3349: ordered_malloc not always keeps the free list ordered.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-08-17 20:53:36
#3349: ordered_malloc not always keeps the free list ordered.
--------------------------------------------------+-------------------------
Reporter: Xiaohan Wang <wangxiaohan@â¦> | Owner: cnewbold
Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: pool
Version: Boost 1.39.0 | Severity: Problem
Keywords: pool, ordered_malloc, add_block |
--------------------------------------------------+-------------------------
Hello,
In function
{{{
template <typename UserAllocator>
void * pool<UserAllocator>::ordered_malloc(const size_type n)
}}}
in pool.hpp, I saw the code below along with the comments:
{{{
// 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 > num_chunks)
store().add_block(node.begin() + num_chunks * partition_size,
node.element_size() - num_chunks * partition_size,
partition_size);
}}}
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.
I guess using ordered_add_block could easily solve this problem.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3349> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC