4.0: grace period for bounded retention (W2) - #24
Open
DanielCech wants to merge 2 commits into
Open
DanielCech wants to merge 2 commits into
DanielCech wants to merge 2 commits into
Conversation
An object still alive at the timeout is watched for a grace period (3 s by default, .deallocationGracePeriod(_:)). Released in that time: a warning, "released after 3.2 sec, later than the 2 sec timeout … bounded retention, not a leak". Still alive: a leak, as before. .zero turns it off. Durations in messages no longer depend on the locale. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
Why
The hardest part of the JustFlip proof of concept was telling a real leak from an object that merely went away late: a store whose task finished after the timeout under simulator load looked exactly like a leak. Finding out meant rerunning the test alone with a longer timeout.
What's new
An object still alive at the timeout is watched for a grace period (3 s by default):
Set it with
.deallocationGracePeriod(_:)orwithDeallocationConfiguration;.zeroturns it off. Passing checks are as fast as before. Only real leaks take the timeout plus the grace period to report.Also fixed: durations in messages used
Duration.formatted, which depends on the locale (on a Czech machine: "3 sec, 250,0 ms … 2,0 sec"). They now read the same everywhere: "400 ms", "2 sec", "3.2 sec".Tests
.zeroturns the grace period off.🤖 Generated with Claude Code