apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.87k stars 717 forks source link

Fix a leak related to use of function used in a closure #3423

Closed prabhuamol closed 1 month ago

prabhuamol commented 1 month ago

There is a leak in fileprivate lazy var loader: DataLoader<CacheKey, Record> because the method implicitly uses self. Making the capture explicit and breaking the retain cycle here. This was also covered in WWDC 2024 analyze heap memory talk https://developer.apple.com/wwdc24/10173?time=1748

Leak detected via instruments

Screenshot 2024-08-07 at 11 41 24 PM
apollo-cla commented 1 month ago

@prabhuamol: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

netlify[bot] commented 1 month ago

Deploy request for apollo-ios-docs pending review.

Visit the deploys page to approve it

Name Link
Latest commit 292cca2e1dc7f2bacf54389aebfe8703d8501eac
github-actions[bot] commented 1 month ago

We do not accept PRs directly to the 'apollo-ios' repo. All development is done through the 'apollo-ios-dev' repo, please see the CONTRIBUTING guide for more information.