!9729 Enable native binding size overshoot during sensitive period

Merge pull request !9729 from lukai/nativeovershoot
This commit is contained in:
openharmony_ci 2024-10-14 20:38:14 +00:00 committed by Gitee
commit 500b7116e1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 13 additions and 1 deletions

View File

@ -98,6 +98,7 @@ public:
sharedHeapLimitGrowingStep_ = 20_MB;
incObjSizeThresholdInSensitive_ = 40_MB;
stepNativeSizeInc_ = 256_MB;
nativeSizeOvershoot_ = 80_MB;
maxNativeSizeInc_ = 768_MB;
} else if (maxHeapSize_ < HIGH_MEMORY) { // 128_MB ~ 256_MB
minSemiSpaceSize_ = 2_MB;
@ -121,6 +122,7 @@ public:
sharedHeapLimitGrowingStep_ = 40_MB;
incObjSizeThresholdInSensitive_ = 40_MB;
stepNativeSizeInc_ = 256_MB;
nativeSizeOvershoot_ = 80_MB;
maxNativeSizeInc_ = 768_MB;
} else { // 256_MB ~ 384_MB
minSemiSpaceSize_ = 2_MB;
@ -144,6 +146,7 @@ public:
sharedHeapLimitGrowingStep_ = 80_MB;
incObjSizeThresholdInSensitive_ = 80_MB;
stepNativeSizeInc_ = 300_MB;
nativeSizeOvershoot_ = 100_MB;
asyncClearNativePointerThreshold_ = 500_MB;
maxNativeSizeInc_ = 1_GB;
}
@ -249,6 +252,11 @@ public:
return stepNativeSizeInc_;
}
size_t GetNativeSizeOvershoot() const
{
return nativeSizeOvershoot_;
}
size_t GetAsyncClearNativePointerThreshold() const
{
return asyncClearNativePointerThreshold_;
@ -312,6 +320,7 @@ private:
size_t sharedHeapLimitGrowingStep_ {0};
size_t incObjSizeThresholdInSensitive_ {0};
size_t stepNativeSizeInc_ {0};
size_t nativeSizeOvershoot_ {0};
size_t asyncClearNativePointerThreshold_ {0};
size_t maxNativeSizeInc_ {0};
size_t maxJSSerializerSize_ {0};

View File

@ -786,6 +786,7 @@ void Heap::Initialize()
gcListeners_.reserve(16U);
nativeSizeTriggerGCThreshold_ = config_.GetMaxNativeSizeInc();
incNativeSizeTriggerGC_ = config_.GetStepNativeSizeInc();
nativeSizeOvershoot_ = config_.GetNativeSizeOvershoot();
asyncClearNativePointerThreshold_ = config_.GetAsyncClearNativePointerThreshold();
idleGCTrigger_ = new IdleGCTrigger(this, sHeap_, thread_, GetEcmaVM()->GetJSOptions().EnableOptionalLog());
}

View File

@ -1464,7 +1464,8 @@ public:
bool GlobalNativeSizeLargerThanLimit() const
{
return GetGlobalNativeSize() >= globalSpaceNativeLimit_;
size_t overshoot = InSensitiveStatus() ? nativeSizeOvershoot_ : 0;
return GetGlobalNativeSize() >= globalSpaceNativeLimit_ + overshoot;
}
bool GlobalNativeSizeLargerThanLimitForIdle() const
@ -1738,6 +1739,7 @@ private:
size_t globalSpaceNativeLimit_ {0};
size_t nativeSizeTriggerGCThreshold_ {0};
size_t incNativeSizeTriggerGC_ {0};
size_t nativeSizeOvershoot_ {0};
size_t asyncClearNativePointerThreshold_ {0};
size_t nativeSizeAfterLastGC_ {0};
size_t nativeBindingSizeAfterLastGC_ {0};