Skip to content

Commit 86c6ad6

Browse files
YQL-17175 added maximum memory limit reached flag (#4480)
1 parent 05549e1 commit 86c6ad6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ydb/library/yql/minikql/aligned_page_pool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ void TAlignedPagePoolImpl<T>::Free(void* ptr, size_t size) noexcept {
503503

504504
template<typename T>
505505
void TAlignedPagePoolImpl<T>::UpdateMemoryYellowZone() {
506-
if (IncreaseMemoryLimitCallback) return;
507506
if (Limit == 0) return;
507+
if (IncreaseMemoryLimitCallback && !IsMaximumLimitValueReached) return;
508508

509509
ui8 usedMemoryPercent = 100 * GetUsed() / Limit;
510510
if (usedMemoryPercent >= EnableMemoryYellowZoneThreshold) {

ydb/library/yql/minikql/aligned_page_pool.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,8 @@ class TAlignedPagePoolImpl {
214214

215215
static void ResetGlobalsUT();
216216

217-
void EnableMemoryYellowZone() noexcept {
218-
IsMemoryYellowZoneReached = true;
219-
}
220-
221-
void DisableMemoryYellowZone() noexcept {
222-
IsMemoryYellowZoneReached = false;
217+
void SetMaximumLimitValueReached(bool isReached) noexcept {
218+
IsMaximumLimitValueReached = isReached;
223219
}
224220

225221
bool IsMemoryYellowZoneEnabled() const noexcept {
@@ -277,6 +273,10 @@ class TAlignedPagePoolImpl {
277273
// The yellow zone turns on when memory consumption reaches 80% and turns off when consumption drops below 50%.
278274
const ui8 EnableMemoryYellowZoneThreshold = 80;
279275
const ui8 DisableMemoryYellowZoneThreshold = 50;
276+
277+
// This flag indicates that value of memory limit reached it's maximum.
278+
// Next TryIncreaseLimit call most likely will return false.
279+
bool IsMaximumLimitValueReached = false;
280280
};
281281

282282
using TAlignedPagePool = TAlignedPagePoolImpl<>;

0 commit comments

Comments
 (0)