|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53989 - sandbox/monotonic/boost/monotonic
From: christian.schladetsch_at_[hidden]
Date: 2009-06-16 23:17:44
Author: cschladetsch
Date: 2009-06-16 23:17:41 EDT (Tue, 16 Jun 2009)
New Revision: 53989
URL: http://svn.boost.org/trac/boost/changeset/53989
Log:
added storage::release, which frees all heap-based allocations
Text files modified:
sandbox/monotonic/boost/monotonic/fixed_storage.h | 4 ++++
sandbox/monotonic/boost/monotonic/shared_storage.h | 5 +++++
sandbox/monotonic/boost/monotonic/static_storage.h | 4 ++++
sandbox/monotonic/boost/monotonic/storage.h | 6 ++++++
sandbox/monotonic/boost/monotonic/storage_base.h | 3 +++
5 files changed, 22 insertions(+), 0 deletions(-)
Modified: sandbox/monotonic/boost/monotonic/fixed_storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/fixed_storage.h (original)
+++ sandbox/monotonic/boost/monotonic/fixed_storage.h 2009-06-16 23:17:41 EDT (Tue, 16 Jun 2009)
@@ -62,6 +62,10 @@
num_allocations = 0;
#endif
}
+ void release()
+ {
+ reset();
+ }
size_t get_cursor() const
{
Modified: sandbox/monotonic/boost/monotonic/shared_storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/shared_storage.h (original)
+++ sandbox/monotonic/boost/monotonic/shared_storage.h 2009-06-16 23:17:41 EDT (Tue, 16 Jun 2009)
@@ -39,6 +39,11 @@
mutex::scoped_lock lock(guard);
storage.reset();
}
+ void release()
+ {
+ mutex::scoped_lock lock(guard);
+ storage.release();
+ }
void *allocate(size_t num_bytes, size_t alignment)
{
mutex::scoped_lock lock(guard);
Modified: sandbox/monotonic/boost/monotonic/static_storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/static_storage.h (original)
+++ sandbox/monotonic/boost/monotonic/static_storage.h 2009-06-16 23:17:41 EDT (Tue, 16 Jun 2009)
@@ -21,6 +21,10 @@
{
global.reset();
}
+ void release()
+ {
+ global.release();
+ }
void *allocate(size_t num_bytes, size_t alignment)
{
return global.allocate(num_bytes, alignment);
Modified: sandbox/monotonic/boost/monotonic/storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/storage.h (original)
+++ sandbox/monotonic/boost/monotonic/storage.h 2009-06-16 23:17:41 EDT (Tue, 16 Jun 2009)
@@ -101,6 +101,12 @@
}
}
+ void release()
+ {
+ reset();
+ chain.swap(Chain());
+ }
+
void *allocate(size_t num_bytes, size_t alignment)
{
if (void *ptr = fixed.allocate(num_bytes, alignment))
Modified: sandbox/monotonic/boost/monotonic/storage_base.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/storage_base.h (original)
+++ sandbox/monotonic/boost/monotonic/storage_base.h 2009-06-16 23:17:41 EDT (Tue, 16 Jun 2009)
@@ -18,6 +18,9 @@
// reset the number of bytes used to zero
virtual void reset() = 0;
+ // reset(), and release all heap-based storage
+ virtual void release() = 0;
+
// the number of bytes to allocate, and the alignment to use
virtual void *allocate(size_t num_bytes, size_t alignment) = 0;
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