Skip to content

fix(node): expose gc from v8 setFlagsFromString#34604

Merged
littledivy merged 6 commits into
mainfrom
orch/divybot-348
Jun 1, 2026
Merged

fix(node): expose gc from v8 setFlagsFromString#34604
littledivy merged 6 commits into
mainfrom
orch/divybot-348

Conversation

@divybot

@divybot divybot commented May 31, 2026

Copy link
Copy Markdown
Contributor

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 #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.

@littledivy
littledivy merged commit a65194c into main Jun 1, 2026
138 checks passed
@littledivy
littledivy deleted the orch/divybot-348 branch June 1, 2026 01:49
littledivy added a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
## 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 denoland#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 <[email protected]>
Co-authored-by: Divy Srivastava <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow setFlagsFromString for --expose-gc

2 participants