From 69bf2c5b03a48ccc580b6d962e040bebef63706a Mon Sep 17 00:00:00 2001 From: zhuhan Date: Sun, 27 Apr 2025 16:07:38 +0800 Subject: [PATCH] large heap Signed-off-by: zhuhan Change-Id: I5dd1a91294d350ddac2d467b5ac93e1bb020703e --- frameworks/native/appkit/app/main_thread.cpp | 1 + frameworks/native/runtime/js_runtime.cpp | 3 ++- interfaces/inner_api/runtime/include/runtime.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frameworks/native/appkit/app/main_thread.cpp b/frameworks/native/appkit/app/main_thread.cpp index 92355cbe0e0..5bf9cdcdd20 100644 --- a/frameworks/native/appkit/app/main_thread.cpp +++ b/frameworks/native/appkit/app/main_thread.cpp @@ -1501,6 +1501,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con options.uid = bundleInfo.applicationInfo.uid; options.apiTargetVersion = appInfo.apiTargetVersion; options.pkgContextInfoJsonStringMap = pkgContextInfoJsonStringMap; + options.allowArkTsLargeHeap = appInfo.allowArkTsLargeHeap; #ifdef CJ_FRONTEND options.lang = isCJApp ? AbilityRuntime::Runtime::Language::CJ : AbilityRuntime::Runtime::Language::JS; #endif diff --git a/frameworks/native/runtime/js_runtime.cpp b/frameworks/native/runtime/js_runtime.cpp index 7a083c5a1a2..4e3a4ff33c6 100644 --- a/frameworks/native/runtime/js_runtime.cpp +++ b/frameworks/native/runtime/js_runtime.cpp @@ -688,6 +688,7 @@ bool JsRuntime::Initialize(const Options& options) auto vm = GetEcmaVm(); CHECK_POINTER_AND_RETURN(vm, false); + panda::JSNApi::SetLargeHeap(options.allowArkTsLargeHeap); if (preloaded_) { PostPreload(options); } @@ -695,7 +696,6 @@ bool JsRuntime::Initialize(const Options& options) napi_value globalObj = nullptr; napi_get_global(env, &globalObj); CHECK_POINTER_AND_RETURN(globalObj, false); - if (!preloaded_) { InitSyscapModule(env); @@ -790,6 +790,7 @@ bool JsRuntime::CreateJsEnv(const Options& options) std::string memConfigProperty = OHOS::system::GetParameter("persist.ark.mem_config_property", ""); size_t gcThreadNum = OHOS::system::GetUintParameter("persist.ark.gcthreads", 7); size_t longPauseTime = OHOS::system::GetUintParameter("persist.ark.longpausetime", 40); + pandaOption.SetLargeHeap(options.allowArkTsLargeHeap); pandaOption.SetArkProperties(arkProperties); pandaOption.SetArkBundleName(bundleName); pandaOption.SetMemConfigProperty(memConfigProperty); diff --git a/interfaces/inner_api/runtime/include/runtime.h b/interfaces/inner_api/runtime/include/runtime.h index 4352d27ba86..5b3312752f1 100644 --- a/interfaces/inner_api/runtime/include/runtime.h +++ b/interfaces/inner_api/runtime/include/runtime.h @@ -56,6 +56,7 @@ public: bool jitEnabled = false; bool isMultiThread = false; bool isErrorInfoEnhance = false; + bool allowArkTsLargeHeap = false; int32_t uid = -1; // ArkTsCard start bool isUnique = false; -- Gitee