Memory Leak on Workflows
Tyler-Keith-Thompson opened this issue · 0 comments
Describe the bug
We're leaking memory every time a workflow is launched and followed.
To Reproduce
Steps to reproduce the behavior:
- Create a workflow (ideally that autocompletes) for example a workflow that proceeds to the next item on
viewDidLoad
after 1 second. - Launch that workflow multiple times
- Make sure the workflow has called
onFinish
. Bonus points: callabandon
on it, NOTE: You should not have to in order to solve this problem, and callingabandon
exposed an additional bug. - Open the memory graph and cry, because the
_WorkflowItem
s got retained when they should not have.
Expected behavior
A workflow should not create retain cycles, it's fine that it retains while executing, but when it is abandoned or when the same workflow is launched again it is reasonable that there aren't retain cycles.
NOTE: The library clears instances when you launch
a Workflow. Is that behavior correct, or is that a bad assumption? It probably has limitations if a user launches the same instance of a workflow multiple times and expects it to just be duplicated. That's an odd thing for a user to expect, but the library does not support it currently. It assumes every call to launch
means it can clear memory of all known instances.