Decreases consumption of this tracker and its ancestors by 'bytes'.
| 220 | |
| 221 | /// Decreases consumption of this tracker and its ancestors by 'bytes'. |
| 222 | void Release(int64_t bytes) { |
| 223 | DCHECK_GE(bytes, 0); |
| 224 | DCHECK(!closed_) << label_; |
| 225 | if (UNLIKELY(bytes <= 0)) return; // < 0 needed in RELEASE, hits DCHECK in DEBUG |
| 226 | |
| 227 | if (consumption_metric_ != nullptr) { |
| 228 | RefreshConsumptionFromMetric(); |
| 229 | return; |
| 230 | } |
| 231 | for (MemTracker* tracker : all_trackers_) { |
| 232 | tracker->consumption_->Add(-bytes); |
| 233 | /// If a UDF calls FunctionContext::TrackAllocation() but allocates less than the |
| 234 | /// reported amount, the subsequent call to FunctionContext::Free() may cause the |
| 235 | /// process mem tracker to go negative until it is synced back to the tcmalloc |
| 236 | /// metric. Don't blow up in this case. (Note that this doesn't affect non-process |
| 237 | /// trackers since we can enforce that the reported memory usage is internally |
| 238 | /// consistent.) |
| 239 | if (tracker->consumption_metric_ == nullptr) { |
| 240 | DCHECK_GE(tracker->consumption_->current_value(), 0) |
| 241 | << std::endl |
| 242 | << tracker->LogUsage(UNLIMITED_DEPTH); |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | /// Transfer 'bytes' of consumption from this tracker to 'dst', updating |
| 248 | /// all ancestors up to the first shared ancestor. Must not be used if |
no test coverage detected