From 0f83d848d1fcf675495d9d43100d6b4ba21cda3d Mon Sep 17 00:00:00 2001 From: oxmc7769 Date: Sun, 26 Jul 2026 04:21:46 -0700 Subject: [PATCH] Remove --always-compact V8 flag: no longer recognized in newer V8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit V8's --js-flags parser stops at the first unrecognized flag and silently drops everything after it in the same string. --always-compact was removed from V8 at some point after the versions bundled in Electron ~41; on newer Electron (confirmed broken on a castlabs v43.0.0+wvcus build) it killed --optimize-for-size right after it in every js-flags string that had it, even though --optimize-for-size itself is still valid. Verified via --v8-options against the actual bundled V8 that gc-global/optimize-for-size/ max-semi-space-size/initial-heap-size are still real flags — only always-compact needed to go. --- src/flags.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/flags.ts b/src/flags.ts index 11ec1c7..3c61708 100644 --- a/src/flags.ts +++ b/src/flags.ts @@ -92,7 +92,7 @@ export function computeFlags(system: SystemInfo, options: ComputeFlagsOptions = logger.log(`Setting Pi JS heap size to: ${heap}MB`); b.addValue( 'js-flags', - `--expose-gc --max-old-space-size=${heap} --gc-global --always-compact --optimize-for-size --max-semi-space-size=1 --initial-heap-size=${Math.floor(heap / 4)}` + `--expose-gc --max-old-space-size=${heap} --gc-global --optimize-for-size --max-semi-space-size=1 --initial-heap-size=${Math.floor(heap / 4)}` ); } } else if (gen === 4) { @@ -104,7 +104,7 @@ export function computeFlags(system: SystemInfo, options: ComputeFlagsOptions = if (enabled(enable, 'jsHeap')) { const heap = jsHeapSizeMB ?? (system.totalMemMB < 2048 ? 1024 : system.totalMemMB < 4096 ? 1536 : 2048); logger.log(`Setting Pi 4 JS heap size to: ${heap}MB`); - b.addValue('js-flags', `--expose-gc --max-old-space-size=${heap} --gc-global --always-compact --optimize-for-size`); + b.addValue('js-flags', `--expose-gc --max-old-space-size=${heap} --gc-global --optimize-for-size`); } } else if (gen >= 5) { b.addValue('enable-features', 'VaapiVideoDecoder,VaapiVideoEncoder') @@ -172,7 +172,7 @@ export function computeFlags(system: SystemInfo, options: ComputeFlagsOptions = // a meaningful chunk of the budget, so cap it. Left unset on 'high' — not worth the // extra minor-GC frequency when memory isn't the constraint. const semiSpaceFlag = system.memoryTier === 'low' ? ' --max-semi-space-size=2' : system.memoryTier === 'medium' ? ' --max-semi-space-size=4' : ''; - b.addValue('js-flags', `--expose-gc --max-old-space-size=${heap} --gc-global --always-compact --optimize-for-size${semiSpaceFlag}`); + b.addValue('js-flags', `--expose-gc --max-old-space-size=${heap} --gc-global --optimize-for-size${semiSpaceFlag}`); } if (enabled(enable, 'diskCache')) {