|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61271 - sandbox/memory/boost/memory
From: xushiweizh_at_[hidden]
Date: 2010-04-14 04:43:52
Author: xushiwei
Date: 2010-04-14 04:43:51 EDT (Wed, 14 Apr 2010)
New Revision: 61271
URL: http://svn.boost.org/trac/boost/changeset/61271
Log:
add pools::alloc_size;
Text files modified:
sandbox/memory/boost/memory/pools.hpp | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
Modified: sandbox/memory/boost/memory/pools.hpp
==============================================================================
--- sandbox/memory/boost/memory/pools.hpp (original)
+++ sandbox/memory/boost/memory/pools.hpp 2010-04-14 04:43:51 EDT (Wed, 14 Apr 2010)
@@ -199,8 +199,20 @@
public:
//
- // function allocate/deallocate
+ // function alloc_size/allocate/deallocate
//
+ size_t BOOST_MEMORY_CALL alloc_size(void* p, size_t cb)
+ {
+ typedef typename PolicyT::system_alloc_type sysalloc;
+
+ if (cb - 1 < (size_type)MAX_BYTES1)
+ return get_pool1(cb).alloc_size();
+ else if (cb - 1 < (size_type)MAX_BYTES2)
+ return get_pool2(cb).alloc_size();
+ else
+ return sysalloc::alloc_size(p);
+ }
+
void* BOOST_MEMORY_CALL allocate(size_t cb)
{
typedef typename PolicyT::system_alloc_type sysalloc;
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