diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-11-15 09:33:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-15 10:33:03 +0100 |
commit | c9baf3849fdbe161a9251a712a71e2b91eeabf3e (patch) | |
tree | 61d082720160d928e303b4e1ae4816d3f228894a /runtime/web_worker.rs | |
parent | dcc75d5685ddb1ad3c1b97721cbc24bf6fa56c76 (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/web_worker.rs')
-rw-r--r-- | runtime/web_worker.rs | 3 |
1 files changed, 3 insertions, 0 deletions
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, |