RxFlow: Memory leak when ending .multiple flow
My app currently has a serious memory leak and I was able to reproduce it in a slightly modified version of the demo app.
It is demonstrated in this branch: https://github.com/wberger/RxFlow/tree/test/multiple_leak
The relevant files are: RxFlowDemo/RxFlowDemo/Flows/AppFlow RxFlowDemo/RxFlowDemo/Flows/DashboardFlow RxFlowDemo/RxFlowDemo/Flows/WishlistFlow
I added a “Logout” button to the wishlist. Hitting this button will trigger a step in WishlistStepper, which in turn ends the WishlistFlow. This ends the parent (= DashboardFlow) and triggers a navigation to the OnboardingFlow from within the AppFlow.
The problem is that only WishlistFlow reaches deinit, while DashboardFlow and WatchedFlow don’t. As a result the whole UITabbarController and all contained ViewControllers are kept.
Reentering the DashboardFlow from onboarding creates new instances while the old dashboard flows and view controllers are kept thus creating a potentially huge memory leak.
I had a quick look at the Flow implementations but wasn’t able to find the error. But in general, when a flow ends, the ending flow and all sub flows have to be released.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 37 (6 by maintainers)
Hi guys
Very interesting. Thanks for the example. I will work on that ASAP.
@twittemb Thank you, this fixes the issue!
I had the same issue and solved it by the simple but hacky solution to remove all VCs in the tab bar on
.end.The latest commit in the develop branch fixes this issue for me.
Thx!
Hi there.
I’m working on RxFlow 2.0.0. It brings some breaking changes and a refactor of the memory management. I think it can address the issues that are exposed in this thread.
It would be great if you could give me your feedback on this version (it is currently on the develop branch)
Here are the changes:
The demo app has been adapted to all those changes.
@dsk1306 There was an issue with my release. Please try again by reinstalling the v1.6.2.
Thanks.
Same issue here
Hi there.
May I close this issue since there hasn’t been any comment about memory leaks for a while now ?
Thanks.
Hi guys,
RxFlow 2.0.0 “Enterprise” is released 🎉.
@twittemb haven’t found any bugs during testing. Can’t wait for version 2.0 😃
@twittemb I would like to take a look)
Hi there. Is there anyone who is willing to test RxFlow 2.0.0 before the release ?
Hi there
I’m on vacation for a few days, i will have finally the time to give some love to RxFlow and bring you some answers.
Stay tuned.
hi @twittemb, thanks for the fix. However, I notice this fix is working on Carthage but CocoaPods. I have same set of code, both are using v1.6.2, but CocoaPods seems still leaking memory.
CocoaPods: https://github.com/fatbunboy/RxFlowTestingPods
Carthage: https://github.com/fatbunboy/RxFlowTesting
Thank you, I will try it tomorrow!