tigase / Martin

(M) Martin - XMPP client library for Swift
Other
69 stars 27 forks source link

memory leak #20

Closed LuigiBertoneri closed 1 year ago

LuigiBertoneri commented 1 year ago

Describe the bug We found memory leaks in the library. Every time the app gets active from the background, memory leaks are generated from XMPPDNSSrvResolver resolve(timeout: TimeInterval) Our app stops connection when goes in background.

To Reproduce Steps to reproduce the behavior:

  1. Open XCode instruments and open leaks and start recording
  2. open the app, go in background, wait few seconds and reopen the app
  3. you can see the memory leak appear, try few times the step 2
  4. stop recording leaks and wait the finish
  5. at the end you can see appear error on XMPPDNSSrvResolver resolve(timeout: TimeInterval)

Expected behavior there you have 2 closures one inside another the last generate a retain. Here you need the [weak self] or unowned than after you need to arrange the code on your choice

Screenshots I've attached 2 screenshots to better understand

Smartphone:

Schermata 2022-10-21 alle 13 30 04 Schermata 2022-10-21 alle 13 29 38
hantu85 commented 1 year ago

Fix was applied in ada5d7e2720964a84f98e7546402568428210a46

LuigiBertoneri commented 1 year ago

Thanks, it works.