Deallocates all memory chunks, excluding the user-supplied buffer.
| 165 | |
| 166 | //! Deallocates all memory chunks, excluding the user-supplied buffer. |
| 167 | void Clear() { |
| 168 | while (chunkHead_ && chunkHead_ != userBuffer_) { |
| 169 | ChunkHeader* next = chunkHead_->next; |
| 170 | baseAllocator_->Free(chunkHead_); |
| 171 | chunkHead_ = next; |
| 172 | } |
| 173 | if (chunkHead_ && chunkHead_ == userBuffer_) |
| 174 | chunkHead_->size = 0; // Clear user buffer |
| 175 | } |
| 176 | |
| 177 | //! Computes the total capacity of allocated memory chunks. |
| 178 | /*! \return total capacity in bytes. |