Skip to content

[SR-2500] deinit not called for singletons #45105

@karwa

Description

@karwa
Previous ID SR-2500
Radar None
Original Reporter @karwa
Type Bug
Status Reopened
Resolution
Environment

Swift 5d21c2a

Additional Detail from JIRA
Votes 1
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 87c3da070e6443586ce467201d6d37fc

Issue Description:

class A {
          static let shared = A()
          private init() {}
          deinit { print("deinit called") }
}
print("\(A.shared)")

Output:

test.A

Expected Output:

test.A
deinit called

Basically I would expect that, at the end of the program, the singleton's deinit would be called. Am I wrong to expect that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions