Repository navigation
[2/4] feat(heap): add watermarked allocation stats and live-only near-OOM filtering - #460
Open
IlyasShabi wants to merge 1 commit into
Open
IlyasShabi wants to merge 1 commit into
IlyasShabi wants to merge 1 commit into
Conversation
Overall package sizeSelf size: 2.82 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | pprof-format | 2.4.1 | 924.37 kB | 924.37 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 was referenced Dec 2, 2026
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 1 Pipeline job failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 508356e | Docs | View more details | Give us feedback! |
IlyasShabi
marked this pull request as ready for review
December 2, 2026 14:43
IlyasShabi
requested review from
nsavoire,
r1viollet and
szegedi
as code owners
December 2, 2026 14:43
szegedi
approved these changes
Dec 4, 2026
szegedi
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, just one little nit, but not critical.
| ); | ||
| if (allocations) heap.profile(); | ||
| if (allocations) { | ||
| let warm = new Array<number>(CHUNK_SIZE / 8).fill(1.5); |
Collaborator
There was a problem hiding this comment.
The new tests only assert that deadShortLivedChurn is absent from the OOM profile. If the churn is ever not sampled, they'd pass even with the live-only filter broken. Could we add a positive check first, e.g. heap.v8Profile() after the churn showing it with allocSpaceBytes > 0?
This branch has not been deployed
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.
Stack
mainishabi/heap-pruner-1-lifecycle-perfBuildAllocationStatsByNodeIdand live-only near-OOM filteringishabi/heap-pruner-2-watermark-oomSamplingHeapPrunerimplementation + design docishabi/heap-pruner-3-sampling-prunerSamplingHeapPruner, remove restart loop, full integration & worker testsMotivation
Introduces the pure-C++ sample watermarking and live-only filtering primitives needed for continuous allocation profiling and accurate near-OOM reporting (DataDog/dd-trace-js#11122).
Changes
bindings/allocation-profile.{hh,cc}):BuildAllocationStatsByNodeIdwith optionalsample_id_watermark,dead_count, andlive_onlyparameters:inuse_*; only samples withsample_id > watermarkcontribute toalloc_*(preventing double-counting surviving live objects across windows).*dead_countand advances*sample_id_watermarkmonotonically without regression.live_only = trueomits dead-only nodes and buckets directly.bindings/translate-heap-profile.{hh,cc},bindings/profilers/near-oom.cc):TranslateAllocationProfileToCppwith optionalconst AllocationProfileNodeStatsMap* live_statsto emit onlyinuse_objects > 0buckets sorted by size and prune dead subtrees (while always keeping root non-null).NearHeapLimiton Node 26+ in allocation mode to filter out dead samples viaBuildAllocationStatsByNodeId(..., /*live_only=*/true)before dumping/exporting/invoking OOM callbacks.bindings/test/binding.cc,ts/test/oom-heap-limit-extension.ts,ts/test/test-heap-profiler.ts):TestBuildAllocationStatsWithWatermarkcovering all 4(is_live, sample_id > watermark)quadrants, multi-window advancement, non-regression,sample_id == watermarkboundary, 64-bit byte math, andlive_only.deadShortLivedChurn) and assert it is excluded from stderr dumps and Async/Interrupt OOM callbacks.