使用HintGC接口触发GC

Signed-off-by: wangyang2022 <wangyang412@huawei.com>
Change-Id: I0d51b76a87d13521ec4e44e001dfb17d90b09e68
This commit is contained in:
wangyang2022 2024-10-11 08:54:40 +00:00
parent 952afb17a3
commit f66ef2f105

View File

@ -263,14 +263,14 @@ void ArkJSRuntime::RunGC()
{
JSExecutionScope executionScope(vm_);
LocalScope scope(vm_);
JSNApi::TriggerGC(vm_, panda::ecmascript::GCReason::TRIGGER_BY_ARKUI, JSNApi::TRIGGER_GC_TYPE::SEMI_GC);
JSNApi::HintGC(vm_, JSNApi::MemoryReduceDegree::LOW, panda::ecmascript::GCReason::TRIGGER_BY_ARKUI);
}
void ArkJSRuntime::RunFullGC()
{
JSExecutionScope executionScope(vm_);
LocalScope scope(vm_);
JSNApi::TriggerGC(vm_, panda::ecmascript::GCReason::TRIGGER_BY_ARKUI, JSNApi::TRIGGER_GC_TYPE::FULL_GC);
JSNApi::HintGC(vm_, JSNApi::MemoryReduceDegree::HIGH, panda::ecmascript::GCReason::TRIGGER_BY_ARKUI);
}
shared_ptr<JsValue> ArkJSRuntime::NewInt32(int32_t value)