mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
trigger gc for l2 device with kill signal
Signed-off-by: lukai <lukai25@huawei.com>
This commit is contained in:
parent
21d9600da4
commit
122e992d8d
@ -504,6 +504,25 @@ bool AceContainer::Dump(const std::vector<std::string>& params)
|
||||
return false;
|
||||
}
|
||||
|
||||
void AceContainer::TriggerGarbageCollection()
|
||||
{
|
||||
#if !defined(OHOS_PLATFORM) || !defined(ENABLE_NATIVE_VIEW)
|
||||
// GPU and IO thread is standalone while disable native view
|
||||
taskExecutor_->PostTask([] { PurgeMallocCache(); }, TaskExecutor::TaskType::GPU);
|
||||
taskExecutor_->PostTask([] { PurgeMallocCache(); }, TaskExecutor::TaskType::IO);
|
||||
#endif
|
||||
taskExecutor_->PostTask([] { PurgeMallocCache(); }, TaskExecutor::TaskType::UI);
|
||||
taskExecutor_->PostTask(
|
||||
[frontend = WeakPtr<Frontend>(frontend_)] {
|
||||
auto sp = frontend.Upgrade();
|
||||
if (sp) {
|
||||
sp->TriggerGarbageCollection();
|
||||
}
|
||||
PurgeMallocCache();
|
||||
},
|
||||
TaskExecutor::TaskType::JS);
|
||||
}
|
||||
|
||||
void AceContainer::AddAssetPath(
|
||||
int32_t instanceId, const std::string& packagePath, const std::vector<std::string>& paths)
|
||||
{
|
||||
|
@ -117,6 +117,8 @@ public:
|
||||
|
||||
bool Dump(const std::vector<std::string>& params) override;
|
||||
|
||||
void TriggerGarbageCollection() override;
|
||||
|
||||
void OnFinish()
|
||||
{
|
||||
if (platformEventCallback_) {
|
||||
|
@ -113,7 +113,7 @@ void ArkJSRuntime::RunGC()
|
||||
{
|
||||
JSExecutionScope executionScope(vm_);
|
||||
LocalScope scope(vm_);
|
||||
JSNApi::TriggerGC(vm_);
|
||||
JSNApi::TriggerGC(vm_, JSNApi::TRIGGER_GC_TYPE::COMPRESS_FULL_GC);
|
||||
}
|
||||
|
||||
shared_ptr<JsValue> ArkJSRuntime::NewInt32(int32_t value)
|
||||
|
@ -114,7 +114,7 @@ void ArkJSRuntime::RunGC()
|
||||
{
|
||||
JSExecutionScope executionScope(vm_);
|
||||
LocalScope scope(vm_);
|
||||
JSNApi::TriggerGC(vm_);
|
||||
JSNApi::TriggerGC(vm_, JSNApi::TRIGGER_GC_TYPE::COMPRESS_FULL_GC);
|
||||
}
|
||||
|
||||
shared_ptr<JsValue> ArkJSRuntime::NewInt32(int32_t value)
|
||||
|
Loading…
Reference in New Issue
Block a user