diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1996-11-17 00:40:23 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1996-11-17 00:40:23 +0000 |
commit | cdaa50473d4305fca20da3227099dcb1de31c1b8 (patch) | |
tree | d3c48504214f87beeb823ccd977e8f0ca0f0bfe2 /ace/Malloc_T.cpp | |
parent | 655565f17014c6ffa30fcd70764e28fad8149ebf (diff) | |
download | ATCD-cdaa50473d4305fca20da3227099dcb1de31c1b8.tar.gz |
Help!
Diffstat (limited to 'ace/Malloc_T.cpp')
-rw-r--r-- | ace/Malloc_T.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp index ace2eb0717f..6e8d9a99132 100644 --- a/ace/Malloc_T.cpp +++ b/ace/Malloc_T.cpp @@ -453,6 +453,29 @@ ACE_Malloc<ACE_MEM_POOL_2, LOCK>::find (const char *name, void *&pointer) } } +template <ACE_MEM_POOL_1, class LOCK> size_t +ACE_Malloc<ACE_MEM_POOL_2, LOCK>::avail_chunks (const size_t size) const +{ + ACE_Read_Guard<LOCK> mon (this->lock_); + + static const size_t mal_size = sizeof (ACE_Malloc_Header); + size_t count = 0; + const size_t sizeof_oversize_ = mal_size / size; + + for (ACE_Malloc_Header *currp = this->cb_ptr_->freep_->s_.next_block_; + ; currp = currp->s_.next_block_) + { + if (currp->s_.size_ * sizeof (ACE_Malloc_Header) >= size_) + count += currp->s_.size_ * sizeof_oversize_; + // How many will fit in this block. + + if (currp == this->cb_ptr_->freep_) + break; + } + + return count; +} + template <ACE_MEM_POOL_1, class LOCK> int ACE_Malloc<ACE_MEM_POOL_2, LOCK>::find (const char *name) { |