Skip to content

Conversation

phausler
Copy link
Contributor

This ensures that the deinitialization triggering of observation is limited to one willSet/onChange event and that keypath that is claimed for that change is then \Self.self

This resolves rdar://153655165

@phausler phausler requested a review from a team as a code owner June 17, 2025 18:23
@phausler phausler force-pushed the pr/observation_deinit_trigger_reduction branch from 83e6f32 to 473c5b5 Compare June 17, 2025 23:11
… one per registrar and send a \Self.self as the keypath to avoid property confusions
@phausler phausler force-pushed the pr/observation_deinit_trigger_reduction branch from 473c5b5 to 071d5b5 Compare June 18, 2025 15:51
@phausler
Copy link
Contributor Author

@swift-ci please test

@phausler
Copy link
Contributor Author

@swift-ci please smoke test

tracker = {
found(selfKp)
}
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to break from just the inner loop and then potentially overwrite the tracker variable on a subsequent iteration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, that would be a performance improvement

@phausler
Copy link
Contributor Author

phausler commented Jul 1, 2025

@swift-ci please test

@phausler
Copy link
Contributor Author

phausler commented Jul 3, 2025

@swift-ci please smoke test

@phausler
Copy link
Contributor Author

phausler commented Jul 8, 2025

@swift-ci please smoke test linux

stephentyrone pushed a commit that referenced this pull request Jul 10, 2025
…e observations in memory (#82752)

Explanation:
This ensures a potential leak with SwiftUI and other systems using
Observation do not leak observation closures when the potential
Observable instances used are only weakly referenced inside the tracking
closure.
 
Scope:
This is limited to the runtime behavior of Observable types and has no
ABI or language level interactions.

Issues:
rdar://112167556

Original PRs:
#79823
#82307

Risk:
Low - This is very targeted to just Observation, however it is a
behavioral change which does not make this a zero risk change.

Testing:
New unit tests were added to catch at least some of the potential cases
this issue can occur with.
@stephentyrone
Copy link
Contributor

@swift-ci smoke test linux

@jamieQ
Copy link
Contributor

jamieQ commented Jul 18, 2025

shall this be merged since the 6.2 version of it already has been?

@phausler phausler closed this Aug 1, 2025
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.

3 participants