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

Method MemoryPoolImpl

bolt/common/memory/MemoryPool.cpp:492–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490}
491
492MemoryPoolImpl::MemoryPoolImpl(
493 MemoryManager* memoryManager,
494 const std::string& name,
495 Kind kind,
496 std::shared_ptr<MemoryPool> parent,
497 std::unique_ptr<MemoryReclaimer> reclaimer,
498 const Options& options)
499 : MemoryPool{name, kind, parent, options},
500 manager_{memoryManager},
501 allocator_{manager_->allocator()},
502 arbitrator_{manager_->arbitrator()},
503 reclaimer_(std::move(reclaimer)),
504 // The memory manager sets the capacity through grow() according to the
505 // actually used memory arbitration policy.
506 capacity_(parent_ != nullptr ? kMaxMemory : 0) {
507 BOLT_CHECK(options.threadSafe || isLeaf());
508 listener_ = std::make_unique<MemoryAllocationListener>(
509 name,
510 this,
511 options.poolRegex,
512 options.singleAllocationThreshold,
513 options.accumulativeAllocationThreshold);
514}
515
516MemoryPoolImpl::~MemoryPoolImpl() {
517 LEAK_CHECK();

Callers

nothing calls this directly

Calls 2

arbitratorMethod · 0.80
allocatorMethod · 0.45

Tested by

no test coverage detected