-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
| Previous ID | SR-14194 |
| Radar | rdar://problem/74274732 |
| Original Reporter | telcy (JIRA User) |
| Type | Bug |
| Status | Resolved |
| Resolution | Invalid |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Foundation |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 39fc7d661ef45654ab81ab331c820df6
Issue Description:
I have a scheduled timer requesting a url every x seconds. For some reason URLSession.shared fills the memory slowly over time and never frees it.
import Foundation
DispatchQueue.global(qos: .default).async {
let url = URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/Italian_States-Piacenza_1626_2_Doppie.jpg/2880px-Italian_States-Piacenza_1626_2_Doppie.jpg")!
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in
URLSession.shared.dataTask(with: url) { _, _, _ in
}.resume()
}
RunLoop.current.run()
}
RunLoop.main.run()