Merge pull request #18774 from azat/memory-tracking-deallocation-respect-level

Respect memory tracker blocker level during deallocations
This commit is contained in:
alexey-milovidov 2021-01-08 07:58:14 +03:00 committed by GitHub
commit 9e77f0faa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -234,7 +234,12 @@ void MemoryTracker::updatePeak(Int64 will_be)
void MemoryTracker::free(Int64 size)
{
if (BlockerInThread::isBlocked(level))
{
/// Since the BlockerInThread should respect the level, we should go to the next parent.
if (auto * loaded_next = parent.load(std::memory_order_relaxed))
loaded_next->free(size);
return;
}
std::bernoulli_distribution sample(sample_probability);
if (unlikely(sample_probability && sample(thread_local_rng)))