MCPcopy Create free account
hub / github.com/bytedance/bolt / growContiguous

Method growContiguous

bolt/common/memory/MemoryPool.cpp:822–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
839int64_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

Callers 3

growMethod · 0.45
TEST_PFunction · 0.45
TEST_PFunction · 0.45

Calls 4

toStringFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by 2

TEST_PFunction · 0.36
TEST_PFunction · 0.36