diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-04-25 08:38:19 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-04-25 08:38:19 +0000 |
commit | 5f0af25f510aff38b563be82feffaa6fe754a434 (patch) | |
tree | be4a14377d887532a5bd2605679935dba88974c0 /ace/Malloc_T.cpp | |
parent | 96db723746a3bdeed63bee252cb9258b52a42773 (diff) | |
download | ATCD-5f0af25f510aff38b563be82feffaa6fe754a434.tar.gz |
ChangeLogTag:Wed Apr 25 03:15:34 2001 Nanbor Wang <nanbor@cs.wustl.edu>
Diffstat (limited to 'ace/Malloc_T.cpp')
-rw-r--r-- | ace/Malloc_T.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp index a8ed0dc2679..084331b08b9 100644 --- a/ace/Malloc_T.cpp +++ b/ace/Malloc_T.cpp @@ -194,6 +194,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::open (void) this->cb_ptr_); this->cb_ptr_->freep_->size_ = 0; + this->cb_ptr_->ref_counter_ = 1; if (rounded_bytes > (sizeof *this->cb_ptr_ + sizeof (MALLOC_HEADER))) { @@ -228,6 +229,8 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::open (void) this->shared_free (p + 1); } } + else + ++this->cb_ptr_->ref_counter_; return 0; } @@ -302,6 +305,14 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove (void) // Give the memory pool a chance to release its resources. result = this->memory_pool_.release (); + // Reset this->cb_ptr_ as it is no longer valid. + // There's also no need to keep the reference counter as the + // underlying memory pool has been destroyed. + // Also notice that we are leaving the decision of removing + // the pool to users so they can map to the same mmap file + // again. + this->cb_ptr_ = 0; + return result; } |