From 9b0c5c4036afa13bad85ba604f231108145a841f Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Sun, 20 Oct 2024 15:04:34 +0000
Subject: [PATCH] wasm: bump dyld v8 heap size limit

This patch adds `--max-old-space-size=8192` to wasm dyld shebang
arguments to bump V8 heap size limit. The default limit
(`heap_size_limit` returned by `v8.getHeapStatistics()`) is
dynamically determined and a bit too low under certain workloads, and
V8 would waste too much CPU time to garbage collect old generation
heap more aggressively. Bumping the limit to 8G doesn't imply dyld
would really take that much memory at run-time, but it lessens V8 heap
stress significantly.

(cherry picked from commit 14c5143899d164c7ac1213d918b4819684538c4b)
---
 utils/jsffi/dyld.mjs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/jsffi/dyld.mjs b/utils/jsffi/dyld.mjs
index 30881cebfbe..ee565836f92 100755
--- a/utils/jsffi/dyld.mjs
+++ b/utils/jsffi/dyld.mjs
@@ -1,4 +1,4 @@
-#!/usr/bin/env -S node --disable-warning=ExperimentalWarning --experimental-wasm-type-reflection --no-turbo-fast-api-calls --wasm-lazy-validation
+#!/usr/bin/env -S node --disable-warning=ExperimentalWarning --experimental-wasm-type-reflection --max-old-space-size=65536 --no-turbo-fast-api-calls --wasm-lazy-validation
 
 // Note [The Wasm Dynamic Linker]
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
GitLab