| 684 | bool needRecordFree) { |
| 685 | CHECK_AND_INC_MEM_OP_STATS(this, Frees); |
| 686 | auto alignmentValue = alignment.has_value() ? alignment.value() : alignment_; |
| 687 | const auto alignedSize = sizeAlign(size, alignmentValue); |
| 688 | if (needRecordFree) { |
| 689 | RECORD_FREE(p, size); |
| 690 | } |
| 691 | allocator_->freeBytes(p, alignedSize); |
| 692 | release(alignedSize); |
| 693 | } |
| 694 | |
| 695 | bool MemoryPoolImpl::transferTo(MemoryPool* dest, void* buffer, uint64_t size) { |
| 696 | if (!isLeaf() || !dest->isLeaf()) { |
| 697 | return false; |
| 698 | } |
| 699 | BOLT_CHECK_NOT_NULL(dest); |
| 700 | auto* destImpl = checked_pointer_cast<MemoryPoolImpl, MemoryPool>(dest); |
| 701 | if (allocator_ != destImpl->allocator_) { |
| 702 | return false; |