|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53598 - sandbox/memory/boost/memory
From: xushiweizh_at_[hidden]
Date: 2009-06-03 09:21:18
Author: xushiwei
Date: 2009-06-03 09:21:17 EDT (Wed, 03 Jun 2009)
New Revision: 53598
URL: http://svn.boost.org/trac/boost/changeset/53598
Log:
region_alloc å¢å çç¥ - m_fPreAlloc: 表示 region_alloc æé æ¶æ¯å¦è¿è¡å
åçé¢åé
ãé»è®¤ä¸º trueã
Text files modified:
sandbox/memory/boost/memory/region_alloc.hpp | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
Modified: sandbox/memory/boost/memory/region_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/region_alloc.hpp (original)
+++ sandbox/memory/boost/memory/region_alloc.hpp 2009-06-03 09:21:17 EDT (Wed, 03 Jun 2009)
@@ -23,7 +23,7 @@
#pragma pack(1)
-template <class PolicyT>
+template <class PolicyT, int m_fPreAlloc = 1>
class region_alloc
{
private:
@@ -68,10 +68,17 @@
void BOOST_MEMORY_CALL init_()
{
- MemBlock* pNew = (MemBlock*)m_alloc.allocate(sizeof(MemBlock));
- pNew->pPrev = NULL;
- m_begin = pNew->buffer;
- m_end = (char*)pNew + m_alloc.alloc_size(pNew);
+ if (m_fPreAlloc)
+ {
+ MemBlock* pNew = (MemBlock*)m_alloc.allocate(sizeof(MemBlock));
+ pNew->pPrev = NULL;
+ m_begin = pNew->buffer;
+ m_end = (char*)pNew + m_alloc.alloc_size(pNew);
+ }
+ else
+ {
+ m_begin = m_end = (char*)HeaderSize;
+ }
}
public:
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