Repository navigation
finalization_registry.ts: tolerate a target kept alive by the conservative stack scan - #112
Merged
Merged
Conversation
…ative stack scan The test dropped two targets and required a callback for both after GC_gcollect. Under gc the collector scans the stack conservatively, so a stray word can keep one alive: it failed once on ubuntu-26.04 (release, compile) in the v0.0-pre-alpha133 release run and passed in the other three legs. Now 200 dropped targets (half registered with themselves as the token) and at least 90% must get a callback, as weakmap_weakset.ts does. What stays exact: no callback during the collection itself, each held value at most once, nothing again on the next use, none for the held target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The release run for v0.0-pre-alpha133 (https://github.com/ASDAlexander77/TypeScriptCompiler/actions/runs/44782299326/job/136474517636) failed on one test:
finalization_registry.ts, ubuntu-26.04,-mm=gc, release/compile leg only (it passed in the jit, debug/compile and debug/jit legs of the same job):The test dropped two targets and required both to be freed. Under gc the collector scans the stack conservatively, so a stray word can keep one alive. That makes it a flaky test, not a bug in the library.
Change (test only): 200 dropped targets (every other one registered with itself as the unregister token), at least 90% must get a callback.
weakmap_weakset.tsalready does it this way. These checks stay exact:GC_gcollectitself, only at the registry's next usecleanupSome()runs nothing againunregisterstill finds and then forgets its tokenLocal (Windows,
-mm=gc): 10/10 JIT runs and 30/30 exe runs pass. A copy that demands more callbacks than there were targets fails, so the threshold check is live.🤖 Generated with Claude Code