|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61129 - sandbox/memory/boost/memory
From: xushiweizh_at_[hidden]
Date: 2010-04-07 11:53:03
Author: xushiwei
Date: 2010-04-07 11:53:02 EDT (Wed, 07 Apr 2010)
New Revision: 61129
URL: http://svn.boost.org/trac/boost/changeset/61129
Log:
DEBUG_POOLS
Text files modified:
sandbox/memory/boost/memory/pools.hpp | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
Modified: sandbox/memory/boost/memory/pools.hpp
==============================================================================
--- sandbox/memory/boost/memory/pools.hpp (original)
+++ sandbox/memory/boost/memory/pools.hpp 2010-04-07 11:53:02 EDT (Wed, 07 Apr 2010)
@@ -204,17 +204,29 @@
void* BOOST_MEMORY_CALL allocate(size_t cb)
{
typedef typename PolicyT::system_alloc_type sysalloc;
+
+ void* p;
+
if (cb - 1 < (size_type)MAX_BYTES1)
- return get_pool1(cb).allocate();
+ p = get_pool1(cb).allocate();
else if (cb - 1 < (size_type)MAX_BYTES2)
- return get_pool2(cb).allocate();
+ p = get_pool2(cb).allocate();
else
- return sysalloc::allocate(cb);
+ p = sysalloc::allocate(cb);
+
+#if defined(_DEBUG_POOLS)
+ printf("pools %p allocate: %p (bytes: %u)\n", this, p, cb);
+#endif
+ return p;
}
void BOOST_MEMORY_CALL deallocate(void* p, size_t cb)
{
typedef typename PolicyT::system_alloc_type sysalloc;
+
+#if defined(_DEBUG_POOLS)
+ printf("pools %p deallocate: %p (bytes: %u)\n", this, p, cb);
+#endif
if (cb - 1 < (size_type)MAX_BYTES1)
get_pool1(cb).deallocate(p);
else if (cb - 1 < (size_type)MAX_BYTES2)
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