fix(ext/node): expose gc from v8 setFlagsFromString (#34604)
## Summary
- implement node:v8 setFlagsFromString handling for
--expose_gc/--expose-gc
- expose a callable gc function in new node:vm contexts after the flag
is set
- add a unit-node regression test for runInNewContext('gc')
Fixes https://github.com/denoland/deno/issues/30317
Closes denoland/divybot#348
## Validation
- cargo fmt --check
- cargo check -p deno_node
- cargo build --bin deno
- ./target/debug/deno eval "import { setFlagsFromString } from
'node:v8'; import { runInNewContext } from 'node:vm'; console.log(typeof
globalThis.gc); setFlagsFromString('--expose_gc'); const gc =
runInNewContext('gc'); console.log(typeof gc); console.log(gc());"
Note: attempted cargo test -p unit_node_tests --test unit_node --
v8_test, but this local checkout fails before executing the test because
tests/util/std/assert/mod.ts is missing from the test fixture path.
---------
Co-authored-by: divybot <divybot@users.noreply.github.com>
Co-authored-by: Divy Srivastava <me@littledivy.com> E
em committed
a65194caedd88f964e67fbaa66b065c817abecff
Parent: 7b230ea
Committed by GitHub <noreply@github.com>
on 6/1/2026, 1:49:22 AM