Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9282] Weak variables in structs leak on String(describing:) or print #51754

tellowkrinkle opened this issue Nov 16, 2018 · 1 comment


Copy link

@tellowkrinkle tellowkrinkle commented Nov 16, 2018

Previous ID SR-9282
Radar None
Original Reporter @tellowkrinkle
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Labels Bug, Leak, Runtime
Assignee None
Priority Medium

md5: 2fe6a872faf2ebd035dd37f74a844177


  • SR-8878 Using Mirror to access a weak reference results in object being retained indefinitely

Issue Description:

The following code should print "Deinit!" before exiting. It does print this on the Swift 4.1 Snapshot 2018-05-31 toolchain, but does not on the Swift 4.2 toolchain that ships with Xcode 10.

class DeinitDetector {
    deinit {
struct WeakHolder {
    weak var a: DeinitDetector!
do {
    let a = DeinitDetector()
    let b = WeakHolder(a: a)
    let _ = String(describing: b)

More info here

Copy link

@swift-ci swift-ci commented Nov 16, 2018

Comment by LinQingmo (JIRA)

I tried it with Swift Development Snapshot 2018-11-13 (a), it works properly. So it seems to be fixed.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants