src: warn when heap would exceed pointer compression limit #67468
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 234 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.327
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #67468"
general
weight: 0.35
anonrig
In builds without pointer compression, emit a process warning with the code HEAP_EXCEEDS_POINTER_COMPRESSION_LIMIT the first time the heap that survives a full garbage collection reaches 6.5 GB / 8 GB threshold. With pointer compression enabled, the heap of each isolate is limited to its 4 GB cage, so applications that currently use larger heaps may run out of memory in builds that enable it.
The check runs in a GC epilogue callback for mark-compact GCs only, is done at most once per Environment, and unregisters itself after the warning has been scheduled. The warning can be silenced with --disable-warning=HEAP_EXCEEDS_POINTER_COMPRESSION_LIMIT.
With any luck, the hope is that we can work towards enabling pointer compression by default in releases.
Note: Node.js builds in V8's multi-cage mode, where the main thread and every worker thread is created in it's own Isolate Group. Every Isolate Group has a max 4 GB heap limit. It used to be that the 4 GB limit was process wide, but that's not the case any longer. However, with pointer compression, no single thread can exceed the 4 GB limit, so applications running larger heaps would crash.
Currently, pointer compression has to be turned on at build, with the default build having it off. I'd like to work towards flipping that. Applications running larger-than-4GB heaps should be the exception but we're forcing every application to use more memory than they need to in order to support those exceptions.
~~For consideration: the warning here may not be entirely accurate yet. An application that hits 4 GB limit today won't actually fail under pointer compression since it will be using less heap... I'm working on refining the heuristic. May be worth holding this PR open until we refine that.~~
Update: Ok, I've updated it so that the warning uses a more accurate threshold... 6.5 GB / 8 GB.