Skip to content

fix(ext/node): add v8.queryObjects() and util.queryObjects()#34159

Merged
littledivy merged 1 commit into
mainfrom
orch/divybot-122
May 17, 2026
Merged

fix(ext/node): add v8.queryObjects() and util.queryObjects()#34159
littledivy merged 1 commit into
mainfrom
orch/divybot-122

Conversation

@divybot

@divybot divybot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Closes denoland/orchid#122

Implements the leak-detection helper exposed by Node's `node:v8` and
`node:util` modules. The count form is what the upstream leak tests
(`parallel/test-diagnostics-channel-memory-leak.js`,
`es-module/test-vm-source-text-module-leak.js`) rely on; without it the
test runner throws `TypeError: queryObjects is not a function`.

V8's `HeapProfiler::QueryObjects` isn't bound in rusty_v8, so the count
is computed by walking the JSON heap snapshot and matching nodes by
constructor name. Taking the snapshot forces a full GC, which is exactly
what the leak tests need. The default ("array") form would require live
object handles and returns an empty array; `{ format: 'summary' }`
returns a one-line summary built from the count.

Co-Authored-By: Divy Srivastava <[email protected]>
@divybot divybot changed the title node compat: add util.queryObjects() for GC/leak tracking feat(ext/node): add v8.queryObjects() and util.queryObjects() May 17, 2026
@fibibot

fibibot commented May 17, 2026

Copy link
Copy Markdown
Contributor

node_compat::parallel::test-dns-resolver-max-timeout.js failed with timeout1: 502, timeout2: 502; main run 25975786283 passed and this PR touches v8/util code. Re-running.

Comment thread ext/node/polyfills/v8.ts
Comment on lines +175 to +176
// would require V8's `HeapProfiler::QueryObjects`, which isn't exposed in the
// rusty_v8 bindings; the count form is what Node's leak tests rely on.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@divybot Open an orchid issue about this rusty_v8 API

@littledivy littledivy changed the title feat(ext/node): add v8.queryObjects() and util.queryObjects() fix(ext/node): add v8.queryObjects() and util.queryObjects() May 17, 2026
@littledivy
littledivy merged commit ffd7a57 into main May 17, 2026
269 of 272 checks passed
@littledivy
littledivy deleted the orch/divybot-122 branch May 17, 2026 05:49
littledivy added a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
…d#34159)

Closes denoland/orchid#122

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.

3 participants