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

Memory usage slowly but steadily increasing #84

Open
FPST-08 opened this issue Jul 7, 2024 · 0 comments
Open

Memory usage slowly but steadily increasing #84

FPST-08 opened this issue Jul 7, 2024 · 0 comments
Assignees
Labels

Comments

@FPST-08
Copy link

FPST-08 commented Jul 7, 2024

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

  1. Brand New Xcode Project
  2. Import Connectivity in ContentView
  3. Replace the placeholder body of the view with the code below
  4. Run on physical device
  5. 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.

Screenshots
Screenshot of memory report in Xcode

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants