pmusolino / Wormholy

iOS network debugging, like a wizard 🧙‍♂️
MIT License
2.32k stars 184 forks source link

Fix a memory leak in CustomHTTPProtocol. #58

Closed andersio closed 5 years ago

andersio commented 5 years ago

There is currently a 5-node retain cycle when Wormholy is presented, primarily because URLSession has a strong delegate reference to CustomHTTPProtocol, which in turn has a strong reference back to the URLSession.

Break the chain when stopLoading() is called, by invalidating the URLSession and so it breaks its strong delegate reference.

pmusolino commented 5 years ago

Thank you very much @andersio for this fix! This PR is in relation to this issue: https://github.com/pmusolino/Wormholy/issues/45