| 177 | } |
| 178 | |
| 179 | void unsynchronized_pool_resource::__adhoc_pool::__do_deallocate( |
| 180 | memory_resource* upstream, void* p, size_t bytes, size_t align) { |
| 181 | _LIBCPP_ASSERT_NON_NULL(__first_ != nullptr, "deallocating a block that was not allocated with this allocator"); |
| 182 | if (__first_->__start_ == p) { |
| 183 | __chunk_footer* next = __first_->__next_; |
| 184 | upstream->deallocate(p, __first_->__allocation_size(), __first_->__align_); |
| 185 | __first_ = next; |
| 186 | } else { |
| 187 | for (__chunk_footer* h = __first_; h->__next_ != nullptr; h = h->__next_) { |
| 188 | if (h->__next_->__start_ == p) { |
| 189 | __chunk_footer* next = h->__next_->__next_; |
| 190 | upstream->deallocate(p, h->__next_->__allocation_size(), h->__next_->__align_); |
| 191 | h->__next_ = next; |
| 192 | return; |
| 193 | } |
| 194 | } |
| 195 | // The request to deallocate memory ends up being a no-op, likely resulting in a memory leak. |
| 196 | _LIBCPP_ASSERT_VALID_DEALLOCATION(false, "deallocating a block that was not allocated with this allocator"); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | class unsynchronized_pool_resource::__fixed_pool { |
| 201 | struct __chunk_footer { |
no test coverage detected