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

Method maybeReserve

bolt/common/memory/MemoryPool.cpp:916–937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

914 // TODO: make this a configurable memory pool option.
915 constexpr int32_t kGrowthQuantum = 8 << 20;
916 const auto reservationToAdd = bits::roundUp(increment, kGrowthQuantum);
917 try {
918 reserve(reservationToAdd, true);
919 } catch (const std::exception& e) {
920 LOG(INFO) << "maybeReserve failed, reason is:" << e.what();
921 if (aborted()) {
922 // NOTE: we shall throw to stop the query execution if the root memory
923 // pool has been aborted. It is also unsafe to proceed as the memory
924 // abort code path might have already freed up the memory resource of
925 // this operator while it is under memory arbitration.
926 std::rethrow_exception(std::current_exception());
927 }
928 return false;
929 }
930 return true;
931}
932
933void MemoryPoolImpl::reserve(uint64_t size, bool reserveOnly) {
934 DETECT_HUGE_RESERVE(size);
935 if (FOLLY_LIKELY(trackUsage_)) {
936 if (FOLLY_LIKELY(threadSafe_)) {
937 reserveThreadSafe(size, reserveOnly);
938 } else {
939 reserveNonThreadSafe(size, reserveOnly);
940 }

Callers 15

splitMethod · 0.45
ensureInputFitsMethod · 0.45
ensureOutputFitsMethod · 0.45
ensureInputFitsMethod · 0.45
ensureInputFitsMethod · 0.45
ensureInputFitsMethod · 0.45
ensureOutputFitsMethod · 0.45
ensureInputFitsMethod · 0.45
ensureOutputFitsMethod · 0.45
ensureInputFitsMethod · 0.45
reserveMemoryMethod · 0.45

Calls 2

roundUpFunction · 0.85
whatMethod · 0.45

Tested by 7

DEBUG_ONLY_TEST_PFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
runMethod · 0.36
runMethod · 0.36
TEST_PFunction · 0.36
TEST_FFunction · 0.36