Skip to content

fix(gc): saturate non_root_count at NON_ROOTS_MAX instead of panicking#4936

Open
shruti2522 wants to merge 1 commit intoboa-dev:mainfrom
shruti2522:fix-non-root-count
Open

fix(gc): saturate non_root_count at NON_ROOTS_MAX instead of panicking#4936
shruti2522 wants to merge 1 commit intoboa-dev:mainfrom
shruti2522:fix-non-root-count

Conversation

@shruti2522
Copy link

It changes the following:

saturating at NON_ROOTS_MAX pins the counter instead of panicking. pinned counter returns true for is_rooted so the object is kept alive rather than freed, a leak is safer than a UAF anyways. The limit ~2^31 heap references to one object is unreachable in practice

@shruti2522 shruti2522 requested a review from a team as a code owner March 7, 2026 22:04
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 49,687 49,687 0
Ignored 2,262 2,262 0
Failed 1,014 1,014 0
Panics 0 0 0
Conformance 93.81% 93.81% 0.00%

Tested main commit: b3d820369072123ded8defc927405b99b9012648
Tested PR commit: dd014547c93397224ca7489737f01968a947c70f
Compare commits: b3d8203...dd01454

@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.79%. Comparing base (6ddc2b4) to head (dd01454).
⚠️ Report is 775 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4936       +/-   ##
===========================================
+ Coverage   47.24%   57.79%   +10.55%     
===========================================
  Files         476      556       +80     
  Lines       46892    60926    +14034     
===========================================
+ Hits        22154    35213    +13059     
- Misses      24738    25713      +975     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@jedel1043
Copy link
Member

Well that would make it so that we underflow after all references get dropped. right? Then we're patching one panic with another one

@shruti2522
Copy link
Author

Well that would make it so that we underflow after all references get dropped. right? Then we're patching one panic with another one

oh yes, missed that 😅 let me look into this more carefully

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants