Skip to content

Commit

Permalink
Merge c13c852 into ded1634
Browse files Browse the repository at this point in the history
  • Loading branch information
lll-phill-lll authored May 13, 2024
2 parents ded1634 + c13c852 commit 88b036d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ydb/library/yql/minikql/aligned_page_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ void TAlignedPagePoolImpl<T>::Free(void* ptr, size_t size) noexcept {

template<typename T>
void TAlignedPagePoolImpl<T>::UpdateMemoryYellowZone() {
if (IncreaseMemoryLimitCallback) return;
if (Limit == 0) return;
if (IncreaseMemoryLimitCallback && !IsMaximumLimitValueReached) return;

ui8 usedMemoryPercent = 100 * GetUsed() / Limit;
if (usedMemoryPercent >= EnableMemoryYellowZoneThreshold) {
Expand Down
12 changes: 6 additions & 6 deletions ydb/library/yql/minikql/aligned_page_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,8 @@ class TAlignedPagePoolImpl {

static void ResetGlobalsUT();

void EnableMemoryYellowZone() noexcept {
IsMemoryYellowZoneReached = true;
}

void DisableMemoryYellowZone() noexcept {
IsMemoryYellowZoneReached = false;
void SetMaximumLimitValueReached(bool isReached) noexcept {
IsMaximumLimitValueReached = isReached;
}

bool IsMemoryYellowZoneEnabled() const noexcept {
Expand Down Expand Up @@ -277,6 +273,10 @@ class TAlignedPagePoolImpl {
// The yellow zone turns on when memory consumption reaches 80% and turns off when consumption drops below 50%.
const ui8 EnableMemoryYellowZoneThreshold = 80;
const ui8 DisableMemoryYellowZoneThreshold = 50;

// This flag indicates that value of memory limit reached it's maximum.
// Next TryIncreaseLimit call most likely will return false.
bool IsMaximumLimitValueReached = false;
};

using TAlignedPagePool = TAlignedPagePoolImpl<>;
Expand Down

0 comments on commit 88b036d

Please sign in to comment.