Skip to content

v8: add heap profile API#62273

Merged
nodejs-github-bot merged 7 commits intonodejs:mainfrom
IlyasShabi:ishabi/v8_heap_profile
Apr 9, 2026
Merged

v8: add heap profile API#62273
nodejs-github-bot merged 7 commits intonodejs:mainfrom
IlyasShabi:ishabi/v8_heap_profile

Conversation

@IlyasShabi
Copy link
Copy Markdown
Member

This PR succeeds #60231 by @theanarkh and adds parameter support for heap sampling on both the main thread and workers.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Mar 16, 2026
@IlyasShabi IlyasShabi force-pushed the ishabi/v8_heap_profile branch from 44720ea to 0221ebd Compare March 16, 2026 09:51
@IlyasShabi IlyasShabi marked this pull request as ready for review March 16, 2026 09:52
@IlyasShabi IlyasShabi force-pushed the ishabi/v8_heap_profile branch from 0221ebd to 5861bc1 Compare March 16, 2026 10:05
@Qard
Copy link
Copy Markdown
Member

Qard commented Mar 16, 2026

cc @nodejs/diagnostics

Copy link
Copy Markdown
Member

@Qard Qard left a comment

Choose a reason for hiding this comment

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

Some DX and future-looking recommendations, but otherwise LGTM.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 93.60731% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.77%. Comparing base (f48ac91) to head (535a6f0).
⚠️ Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
src/util.cc 85.71% 1 Missing and 8 partials ⚠️
src/node_v8.cc 91.17% 1 Missing and 2 partials ⚠️
lib/v8.js 95.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #62273    +/-   ##
========================================
  Coverage   89.77%   89.77%            
========================================
  Files         697      698     +1     
  Lines      215749   215915   +166     
  Branches    41304    41311     +7     
========================================
+ Hits       193681   193845   +164     
  Misses      14161    14161            
- Partials     7907     7909     +2     
Files with missing lines Coverage Δ
lib/internal/v8/heap_profile.js 100.00% <100.00%> (ø)
lib/internal/worker.js 96.61% <100.00%> (+0.09%) ⬆️
src/node_worker.cc 81.71% <100.00%> (+0.20%) ⬆️
src/node_worker.h 91.66% <ø> (ø)
src/util.h 91.20% <100.00%> (+0.29%) ⬆️
lib/v8.js 98.75% <95.00%> (-0.30%) ⬇️
src/node_v8.cc 82.12% <91.17%> (+0.41%) ⬆️
src/util.cc 87.22% <85.71%> (-0.23%) ⬇️

... and 20 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@IlyasShabi IlyasShabi requested review from Qard and addaleax March 17, 2026 08:43
@IlyasShabi IlyasShabi added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@IlyasShabi IlyasShabi added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 26, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 26, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@IlyasShabi IlyasShabi force-pushed the ishabi/v8_heap_profile branch from f3585b5 to 20bcbff Compare April 7, 2026 13:44
@IlyasShabi
Copy link
Copy Markdown
Member Author

Can't get rid of flakiness, rebasing on main and pushing again. Can I get an approval again? 🥺

@IlyasShabi IlyasShabi force-pushed the ishabi/v8_heap_profile branch from 20bcbff to 535a6f0 Compare April 7, 2026 15:21
@IlyasShabi IlyasShabi added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 8, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 8, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@IlyasShabi IlyasShabi added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. commit-queue Add this label to land a pull request using GitHub Actions. labels Apr 9, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Apr 9, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/62273
✔  Done loading data for nodejs/node/pull/62273
----------------------------------- PR info ------------------------------------
Title      v8: add heap profile API (#62273)
Author     Ilyas Shabi <ilyasshabi94@gmail.com> (@IlyasShabi)
Branch     IlyasShabi:ishabi/v8_heap_profile -> nodejs:main
Labels     c++, lib / src, author ready, needs-ci, commit-queue-rebase
Commits    7
 - v8: add heap profile API
 - support heap sampling params
 - add params as options object
 - load heap_profile module in worker
 - make gc flags constants
 - fix linter
 - use NODE_DEFINE_CONSTANT for gc flags
Committers 1
 - ishabi <ilyasshabi94@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Mon, 16 Mar 2026 09:34:54 GMT
   ✔  Approvals: 3
   ✔  - Stephen Belanger (@Qard): https://github.com/nodejs/node/pull/62273#pullrequestreview-4030505403
   ✔  - Gürgün Dayıoğlu (@gurgunday): https://github.com/nodejs/node/pull/62273#pullrequestreview-3960438243
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/62273#pullrequestreview-4031306391
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-04-08T12:55:41Z: https://ci.nodejs.org/job/node-test-pull-request/72560/
- Querying data for job/node-test-pull-request/72560/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 62273
From https://github.com/nodejs/node
 * branch                  refs/pull/62273/merge -> FETCH_HEAD
✔  Fetched commits as e6ef4774c202..535a6f0bfa3e
--------------------------------------------------------------------------------
[main b9fbd693ab] v8: add heap profile API
 Author: theanarkh <theratliter@gmail.com>
 Date: Mon Oct 13 00:34:58 2025 +0800
 8 files changed, 177 insertions(+), 60 deletions(-)
 create mode 100644 test/parallel/test-v8-heap-profile.js
[main 713f14a638] support heap sampling params
 Author: ishabi <ilyasshabi94@gmail.com>
 Date: Sun Mar 15 21:05:36 2026 +0100
 11 files changed, 378 insertions(+), 23 deletions(-)
 create mode 100644 lib/internal/v8/heap_profile.js
[main f4d4b12121] add params as options object
 Author: ishabi <ilyasshabi94@gmail.com>
 Date: Mon Mar 16 20:24:37 2026 +0100
 8 files changed, 160 insertions(+), 168 deletions(-)
[main 1bde172752] load heap_profile module in worker
 Author: ishabi <ilyasshabi94@gmail.com>
 Date: Tue Mar 17 15:09:00 2026 +0100
 1 file changed, 3 insertions(+), 3 deletions(-)
[main 636cf5c518] make gc flags constants
 Author: ishabi <ilyasshabi94@gmail.com>
 Date: Mon Mar 30 12:47:02 2026 +0200
 2 files changed, 43 insertions(+), 28 deletions(-)
[main fe7d47df23] fix linter
 Author: ishabi <ilyasshabi94@gmail.com>
 Date: Mon Mar 30 14:51:21 2026 +0200
 1 file changed, 1 insertion(+), 1 deletion(-)
[main df02eeb844] use NODE_DEFINE_CONSTANT for gc flags
 Author: ishabi <ilyasshabi94@gmail.com>
 Date: Mon Mar 30 15:33:34 2026 +0200
 1 file changed, 18 insertions(+), 49 deletions(-)
   ✔  Patches applied
There are 7 commits in the PR. Attempting autorebase.
(node:348) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/14)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
v8: add heap profile API

PR-URL: #62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>

[detached HEAD 5f7b36f8b0] v8: add heap profile API
Author: theanarkh <theratliter@gmail.com>
Date: Mon Oct 13 00:34:58 2025 +0800
8 files changed, 177 insertions(+), 60 deletions(-)
create mode 100644 test/parallel/test-v8-heap-profile.js
Rebasing (3/14)
Rebasing (4/14)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
support heap sampling params

PR-URL: #62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>

[detached HEAD 5be077c7a1] support heap sampling params
Author: ishabi <ilyasshabi94@gmail.com>
Date: Sun Mar 15 21:05:36 2026 +0100
11 files changed, 378 insertions(+), 23 deletions(-)
create mode 100644 lib/internal/v8/heap_profile.js
Rebasing (5/14)
Rebasing (6/14)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
add params as options object

PR-URL: #62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>

[detached HEAD 7ab7d6e4f2] add params as options object
Author: ishabi <ilyasshabi94@gmail.com>
Date: Mon Mar 16 20:24:37 2026 +0100
8 files changed, 160 insertions(+), 168 deletions(-)
Rebasing (7/14)
Rebasing (8/14)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
load heap_profile module in worker

PR-URL: #62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>

[detached HEAD a7413ee467] load heap_profile module in worker
Author: ishabi <ilyasshabi94@gmail.com>
Date: Tue Mar 17 15:09:00 2026 +0100
1 file changed, 3 insertions(+), 3 deletions(-)
Rebasing (9/14)
Rebasing (10/14)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
make gc flags constants

PR-URL: #62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>

[detached HEAD c80cbf92ff] make gc flags constants
Author: ishabi <ilyasshabi94@gmail.com>
Date: Mon Mar 30 12:47:02 2026 +0200
2 files changed, 43 insertions(+), 28 deletions(-)
Rebasing (11/14)
Rebasing (12/14)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
fix linter

PR-URL: #62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>

[detached HEAD abf47fcf69] fix linter
Author: ishabi <ilyasshabi94@gmail.com>
Date: Mon Mar 30 14:51:21 2026 +0200
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (13/14)
Rebasing (14/14)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
use NODE_DEFINE_CONSTANT for gc flags

PR-URL: #62273
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>

[detached HEAD ec56a1176d] use NODE_DEFINE_CONSTANT for gc flags
Author: ishabi <ilyasshabi94@gmail.com>
Date: Mon Mar 30 15:33:34 2026 +0200
1 file changed, 18 insertions(+), 49 deletions(-)
Successfully rebased and updated refs/heads/main.

✔ 5f7b36f8b0eb6302e2554431003b1b1c7003e2ac
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ 5be077c7a18bdec5f065af452ecf2f65e534e70b
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✖ 0:0 Missing subsystem. subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ 7ab7d6e4f2b8d5d4f75d86c38faced7f1b0e5410
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✖ 0:0 Missing subsystem. subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ a7413ee4676fe59d38e170833a4ec898af079c8d
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✖ 0:0 Missing subsystem. subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ c80cbf92ff01c047eec65e19c275c9e1369bffb1
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✖ 0:0 Missing subsystem. subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ abf47fcf691900ded85e5455b059ef1a60b76c61
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✖ 0:0 Missing subsystem. subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ ec56a1176d3dbe9e135cee48665e5eac422179e9
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✖ 0:0 Missing subsystem. subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
ℹ Please fix the commit message and try again.
Please manually ammend the commit message, by running
git commit --amend
Once commit message is fixed, finish the landing command running
git node land --continue

https://github.com/nodejs/node/actions/runs/24193400736

@IlyasShabi IlyasShabi added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. labels Apr 9, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 9, 2026
@nodejs-github-bot nodejs-github-bot merged commit f8b79a1 into nodejs:main Apr 9, 2026
87 checks passed
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in f8b79a1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants