MCPcopy Create free account
hub / github.com/apache/impala / TransferTo

Method TransferTo

be/src/runtime/mem-tracker.cc:260–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260void MemTracker::TransferTo(MemTracker* dst, int64_t bytes) {
261 DCHECK_EQ(all_trackers_.back(), dst->all_trackers_.back())
262 << "Must have same root";
263 // Find the common ancestor and update trackers between 'this'/'dst' and
264 // the common ancestor. This logic handles all cases, including the
265 // two trackers being the same or being ancestors of each other because
266 // 'all_trackers_' includes the current tracker.
267 int ancestor_idx = all_trackers_.size() - 1;
268 int dst_ancestor_idx = dst->all_trackers_.size() - 1;
269 while (ancestor_idx > 0 && dst_ancestor_idx > 0
270 && all_trackers_[ancestor_idx - 1] == dst->all_trackers_[dst_ancestor_idx - 1]) {
271 --ancestor_idx;
272 --dst_ancestor_idx;
273 }
274 MemTracker* common_ancestor = all_trackers_[ancestor_idx];
275 ReleaseLocal(bytes, common_ancestor);
276 dst->ConsumeLocal(bytes, common_ancestor);
277}
278
279// Calling this on the query tracker results in output like:
280//

Callers 4

AcquireDataMethod · 0.80
SetMemTrackerMethod · 0.80
TESTFunction · 0.80
SetMemTrackerMethod · 0.80

Calls 2

ConsumeLocalMethod · 0.80
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64