summaryrefslogtreecommitdiff
path: root/ace/Malloc_T.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2002-03-28 16:24:13 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2002-03-28 16:24:13 +0000
commitd591d6cfde5be46c24bb51fc164658dd0c99b0bd (patch)
treef74ffe2acc4478c9dcb1711949abdbbf4d2fd197 /ace/Malloc_T.cpp
parent69b2f9d73de023c37fc42b4c8cd985807b37447b (diff)
downloadATCD-d591d6cfde5be46c24bb51fc164658dd0c99b0bd.tar.gz
ChangeLogTag:Thu Mar 28 10:12:13 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
Diffstat (limited to 'ace/Malloc_T.cpp')
-rw-r--r--ace/Malloc_T.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp
index 74b97b3d4b1..a5ce3677ea1 100644
--- a/ace/Malloc_T.cpp
+++ b/ace/Malloc_T.cpp
@@ -41,6 +41,35 @@ ACE_Cached_Allocator<T, ACE_LOCK>::~ACE_Cached_Allocator (void)
delete [] this->pool_;
}
+template <class ACE_LOCK>
+ACE_Dynamic_Cached_Allocator<ACE_LOCK>::ACE_Dynamic_Cached_Allocator
+ (size_t n_chunks, size_t chunk_size)
+ : pool_ (0),
+ free_list_ (ACE_PURE_FREE_LIST),
+ chunk_size_(chunk_size)
+{
+ ACE_NEW (this->pool_, char[n_chunks * chunk_size_]);
+
+ for (size_t c = 0;
+ c < n_chunks;
+ c++)
+ {
+ void* placement = this->pool_ + c * chunk_size_;
+
+ this->free_list_.add (new (placement) ACE_Cached_Mem_Pool_Node<char>);
+ }
+ // Put into free list using placement contructor, no real memory
+ // allocation in the above <new>.
+}
+
+template <class ACE_LOCK>
+ACE_Dynamic_Cached_Allocator<ACE_LOCK>::~ACE_Dynamic_Cached_Allocator (void)
+{
+ delete [] this->pool_;
+ this->pool_ = 0;
+ chunk_size_ = 0;
+}
+
ACE_ALLOC_HOOK_DEFINE (ACE_Malloc_T)
template <class MALLOC> int