-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
| Previous ID | SR-15120 |
| Radar | None |
| Original Reporter | grill2010 (JIRA User) |
| Type | Bug |
| Status | Closed |
| Resolution | Invalid |
Attachment: Download
Environment
I'm using
XCode 12.5.1
Swift 5.5
Minimum iOS version
13.0
The app is built for iPhone and iPad
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Foundation |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 54829ec4c92d275e0feacca6ee17bd9b
Issue Description:
I'm creating a Thread in my ViewModel in Swift like this
import Foundation
class TestViewViewModel: ObservableObject {
private var testThread: TestThread?
public func initViewModel() {
testThread = TestThread.init()
}
public func deinitViewModel() {
testThread?.cancel()
testThread = nil
}
/*+++++++++++++++*/
/*+ Test thread +*/
/*+++++++++++++++*/
private class TestThread: Thread {
override init(){
print("Init RenderThread")
}
deinit {
print("deinit RenderThread")
}
override func main() {
}
}
}I'm not even starting the thread but even after calling deinitViewModel some stuff of the Thread got leaked according to the XCode memory profiler (look at the attached screenshot). It seems it's the threadDictionary but I'm not sure.