Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67676 - in sandbox/guild/pool: boost/pool libs/pool/test
From: chankwanting_at_[hidden]
Date: 2011-01-05 04:00:19


Author: ktchan
Date: 2011-01-05 04:00:14 EST (Wed, 05 Jan 2011)
New Revision: 67676
URL: http://svn.boost.org/trac/boost/changeset/67676

Log:
Fixes bug #3349. Add temporary test for bug.
Added:
   sandbox/guild/pool/libs/pool/test/test_bug_3349.cpp (contents, props changed)
Text files modified:
   sandbox/guild/pool/boost/pool/pool.hpp | 5 +----
   sandbox/guild/pool/libs/pool/test/Jamfile.v2 | 1 +
   2 files changed, 2 insertions(+), 4 deletions(-)

Modified: sandbox/guild/pool/boost/pool/pool.hpp
==============================================================================
--- sandbox/guild/pool/boost/pool/pool.hpp (original)
+++ sandbox/guild/pool/boost/pool/pool.hpp 2011-01-05 04:00:14 EST (Wed, 05 Jan 2011)
@@ -526,11 +526,8 @@
   const details::PODptr<size_type> node(ptr, POD_size);
 
   // 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,
+ store().add_ordered_block(node.begin() + num_chunks * partition_size,
         node.element_size() - num_chunks * partition_size, partition_size);
 
   next_size <<= 1;

Modified: sandbox/guild/pool/libs/pool/test/Jamfile.v2
==============================================================================
--- sandbox/guild/pool/libs/pool/test/Jamfile.v2 (original)
+++ sandbox/guild/pool/libs/pool/test/Jamfile.v2 2011-01-05 04:00:14 EST (Wed, 05 Jan 2011)
@@ -18,4 +18,5 @@
     [ run test_pool_alloc.cpp ]
     [ run pool_msvc_compiler_bug_test.cpp ]
     [ run test_msvc_mem_leak_detect.cpp ]
+ [ run test_bug_3349.cpp ]
     ;

Added: sandbox/guild/pool/libs/pool/test/test_bug_3349.cpp
==============================================================================
--- (empty file)
+++ sandbox/guild/pool/libs/pool/test/test_bug_3349.cpp 2011-01-05 04:00:14 EST (Wed, 05 Jan 2011)
@@ -0,0 +1,25 @@
+/* Copyright (C) 2011 Kwan Ting Chan
+ * Based from bug report submitted by Xiaohan Wang
+ *
+ * Use, modification and distribution is subject to the
+ * Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// Test of bug #3349 (https://svn.boost.org/trac/boost/ticket/3349)
+
+#include <boost/pool/pool.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+
+int main()
+{
+ boost::pool<> p(256, 4);
+
+ void* pBlock1 = p.ordered_malloc( 1 );
+ void* pBlock2 = p.ordered_malloc( 4 );
+
+ p.ordered_free( pBlock1 );
+
+ BOOST_TEST(p.release_memory());
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk