summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-11-15 09:33:03 +0000
committerGitHub <noreply@github.com>2024-11-15 10:33:03 +0100
commitc9baf3849fdbe161a9251a712a71e2b91eeabf3e (patch)
tree61d082720160d928e303b4e1ae4816d3f228894a /runtime
parentdcc75d5685ddb1ad3c1b97721cbc24bf6fa56c76 (diff)
perf: use available system memory for v8 isolate memory limit (#26868)
Instead of using the default 1.4Gb limit (which was meant for browser tabs) configure V8 to set the heap limit to the amount of memory available in the system. Closes https://github.com/denoland/deno/issues/23424 Closes https://github.com/denoland/deno/issues/26435 Closes https://github.com/denoland/deno/issues/21226
Diffstat (limited to 'runtime')
-rw-r--r--runtime/lib.rs1
-rw-r--r--runtime/ops/os/mod.rs3
-rw-r--r--runtime/sys_info.rs (renamed from runtime/ops/os/sys_info.rs)0
-rw-r--r--runtime/web_worker.rs3
4 files changed, 5 insertions, 2 deletions
diff --git a/runtime/lib.rs b/runtime/lib.rs
index 8a228c5b5..a6e60ced1 100644
--- a/runtime/lib.rs
+++ b/runtime/lib.rs
@@ -35,6 +35,7 @@ pub mod js;
pub mod ops;
pub mod permissions;
pub mod snapshot;
+pub mod sys_info;
pub mod tokio_util;
pub mod web_worker;
pub mod worker;
diff --git a/runtime/ops/os/mod.rs b/runtime/ops/os/mod.rs
index b10a2939e..74c708c53 100644
--- a/runtime/ops/os/mod.rs
+++ b/runtime/ops/os/mod.rs
@@ -1,5 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+use crate::sys_info;
use crate::worker::ExitCode;
use deno_core::op2;
use deno_core::v8;
@@ -11,8 +12,6 @@ use serde::Serialize;
use std::collections::HashMap;
use std::env;
-mod sys_info;
-
deno_core::extension!(
deno_os,
ops = [
diff --git a/runtime/ops/os/sys_info.rs b/runtime/sys_info.rs
index cffc90e9d..cffc90e9d 100644
--- a/runtime/ops/os/sys_info.rs
+++ b/runtime/sys_info.rs
diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs
index b056e01fc..8e0c870d1 100644
--- a/runtime/web_worker.rs
+++ b/runtime/web_worker.rs
@@ -361,6 +361,8 @@ pub struct WebWorkerOptions {
pub extensions: Vec<Extension>,
pub startup_snapshot: Option<&'static [u8]>,
pub unsafely_ignore_certificate_errors: Option<Vec<String>>,
+ /// Optional isolate creation parameters, such as heap limits.
+ pub create_params: Option<v8::CreateParams>,
pub seed: Option<u64>,
pub create_web_worker_cb: Arc<ops::worker_host::CreateWebWorkerCb>,
pub format_js_error_fn: Option<Arc<FormatJsErrorFn>>,
@@ -563,6 +565,7 @@ impl WebWorker {
let mut js_runtime = JsRuntime::new(RuntimeOptions {
module_loader: Some(services.module_loader),
startup_snapshot: options.startup_snapshot,
+ create_params: options.create_params,
get_error_class_fn: options.get_error_class_fn,
shared_array_buffer_store: services.shared_array_buffer_store,
compiled_wasm_module_store: services.compiled_wasm_module_store,