gc: Fix GC heap size growing without bound with BigInt use #64027
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 264 lines diff across 3 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.334
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #64027"
general
weight: 0.35
topolarity
The counted allocators add the usable size of the block (
memory_block_usable_size) toheap_sizeon allocation, but GMP's free and realloc hooks (jl_gmp_counted_free_with_size,jl_gmp_counted_realloc_with_old_size) subtracted the size GMP requested. EveryBigIntallocation therefore left its allocator slack inheap_sizeandlive_bytesforever: after 20Mbig(i)the GC accounted for 460 MB while 46 MB was resident. Once the phantom heap passes the heap-size hint, every collection becomes a full one, and with--hard-heap-limitthe process eventually aborts.Use the usable size of the block in the GMP hooks instead.
As an example:
master:
PR:
Note that the actual memory usage is not a problem here, it is just the GC's own accounting, which drives its full-GC decisions and the hard limit. Also, the full GCs even in the PR state is another issue (dead BigInts waiting on finalizers are counted as promote).
Assisted-by: Claude Code (Claude Opus 5.5)