-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Have read the known issues?
[ ] Yes, I have read and am familiar with the list of known issues.
Have tested on a physical device?
[ ] Yes, I have tested on physical iOS device and the reported issue is still present.
Does code retain the Connectivity object?
[ ] Yes, my implementation has a strong reference to the Connectivity object so that it is not deallocated during use.
Describe the bug
I am using SwiftUI. A button that triggers continuous polling causes the memory usage to slowly increase. First the app freezes for 800 to 2000 ms while decreasing memory usage before memory usage picks up again and almost linearly increases.
To Reproduce
- Brand New Xcode Project
- Import Connectivity in ContentView
- Replace the placeholder body of the view with the code below
- Run on physical device
- Press button and monitor memory usage
Button("Check") {
let connectivity = Connectivity()
connectivity.pollingInterval = 2
connectivity.isPollingEnabled = true
let connectivityChanged: (Connectivity) -> Void = { connectivity in
print(connectivity.status)
}
connectivity.whenConnected = connectivityChanged
connectivity.whenDisconnected = connectivityChanged
connectivity.startNotifier()
}
Expected behavior
I expect that the memory usage increases but that it levels off at some point which it does not. This way the device will run out of memory at some point.
Smartphone:
- Device: Physical iPhone 12
- OS: iOS 17.5.1 (21F90)
- Browser: Safari using Google
- Version: Couldn't find. Most likely latest
- Xcode Version 15.4
