| 820 | const uint64_t oldSize = allocation.size(); |
| 821 | if (!allocator_->growContiguous( |
| 822 | increment, allocation, [this](uint64_t allocBytes, bool preAlloc) { |
| 823 | if (preAlloc) { |
| 824 | reserve(allocBytes); |
| 825 | } else { |
| 826 | release(allocBytes); |
| 827 | } |
| 828 | })) { |
| 829 | handleAllocationFailure(fmt::format( |
| 830 | "{} failed with {} pages from {} {}", |
| 831 | __FUNCTION__, |
| 832 | increment, |
| 833 | toString(), |
| 834 | allocator_->getAndClearFailureMessage())); |
| 835 | } |
| 836 | RECORD_GROW(oldAddr, allocation.data(), oldSize, allocation.size()); |
| 837 | } |
| 838 | |
| 839 | int64_t MemoryPoolImpl::capacity() const { |
| 840 | if (parent_ != nullptr) { |
| 841 | return parent_->capacity(); |
| 842 | } |
| 843 | std::lock_guard<std::mutex> l(mutex_); |
| 844 | return capacity_; |
| 845 | } |
| 846 | |