Repository navigation
fix: avoid forced GC during allocation profile collection - #435
Merged
Merged
Conversation
Overall package sizeSelf size: 2.62 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | pprof-format | 2.4.0 | 912.36 kB | 912.36 kB | | source-map | 0.8.0 | 185.66 kB | 185.66 kB | | node-gyp-build | 4.8.4 | 13.86 kB | 13.86 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
This comment has been minimized.
This comment has been minimized.
IlyasShabi
marked this pull request as ready for review
November 9, 2026 08:47
IlyasShabi
requested review from
nsavoire,
r1viollet and
szegedi
as code owners
November 9, 2026 08:47
szegedi
approved these changes
Nov 9, 2026
szegedi
left a comment
Collaborator
There was a problem hiding this comment.
If I understand correctly, this does not even affect the precision of allocation profiles, since they report live + collected and the sum remains the same with or without GC, only the summands change. If anything, this improved the precision of heap live size profiles, since without it it can report samples for unreachable, but not yet collected objects as live, which is how it worked before allocation profiling anyway. Do I see it right?
nsavoire
approved these changes
Nov 9, 2026
Author
|
@szegedi Yes that’s right! Removing the flag affects the freshness of live heap, not the accuracy of allocation profiles. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Removes
kSamplingForceGCfrom allocation profiling on Node.js 26+, so collecting a profile no longer requests a full GC. It also updates the documentation in the code and adds a simple regression test.Motivation
We identified that allocation profiling forces a full GC every time we collect a profile. This adds GC work and can cause long pauses on the main thread. Removing the flag avoids those extra collections and their pause overhead.
Additional Notes
Some objects that are no longer reachable may still be reported as live because V8 has not collected them yet. This can overestimate live heap usage at collection time. For a statistical profiler, we prefer this tradeoff to forcing a full GC on every profile.
Jira SCP-1457