diff --git a/ydb/library/yql/minikql/aligned_page_pool.cpp b/ydb/library/yql/minikql/aligned_page_pool.cpp index f4ad5f3550ff..72e08113df6b 100644 --- a/ydb/library/yql/minikql/aligned_page_pool.cpp +++ b/ydb/library/yql/minikql/aligned_page_pool.cpp @@ -504,6 +504,7 @@ void TAlignedPagePoolImpl::Free(void* ptr, size_t size) noexcept { template void TAlignedPagePoolImpl::UpdateMemoryYellowZone() { if (Limit == 0) return; + if (IsMemoryYellowZoneForcefullyChanged) return; if (IncreaseMemoryLimitCallback && !IsMaximumLimitValueReached) return; ui8 usedMemoryPercent = 100 * GetUsed() / Limit; diff --git a/ydb/library/yql/minikql/aligned_page_pool.h b/ydb/library/yql/minikql/aligned_page_pool.h index 869faf22ce17..9af3799d4261 100644 --- a/ydb/library/yql/minikql/aligned_page_pool.h +++ b/ydb/library/yql/minikql/aligned_page_pool.h @@ -222,6 +222,11 @@ class TAlignedPagePoolImpl { return IsMemoryYellowZoneReached; } + void ForcefullySetMemoryYellowZone(bool isEnabled) noexcept { + IsMemoryYellowZoneReached = isEnabled; + IsMemoryYellowZoneForcefullyChanged = true; + } + protected: void* Alloc(size_t size); void Free(void* ptr, size_t size) noexcept; @@ -268,6 +273,10 @@ class TAlignedPagePoolImpl { // Indicates when memory limit is almost reached. bool IsMemoryYellowZoneReached = false; + // Indicates that memory yellow zone was enabled or disabled forcefully. + // If the value of this variable is true, then the limits specified below will not be applied and + // changing the value can only be done manually. + bool IsMemoryYellowZoneForcefullyChanged = false; // This theshold is used to determine is memory limit is almost reached. // If TIncreaseMemoryLimitCallback is set this thresholds should be ignored. // The yellow zone turns on when memory consumption reaches 80% and turns off when consumption drops below 50%.