-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A possible memory leak when composable architecture is combined with the composable core location #8
Comments
Thanks for the report, I was able to repro this and I think your example is doing everything just fine. I don't exactly see how anything could be leaking, and unfortunately the memory debugger (and even the leaks instrument) isn't giving much helpful information. I'll try to investigate more, but I'm a bit stumped right now 😟 |
Thanks for taking the time and checking out the demo. I also don't know what's going on, it doesn't make any sense. As I said above, we removed the I forgot to mention one more thing. We are using a 3rd party framework which internally starts monitoring regions and as a result, the composable core location dependency is notified about those events too. Unfortunately, Anyways, thanks again 🙏 . I'll let you know if I find anything out. |
Yeah, the fact that not combining reducers changes this makes me think it's actually secretly a Combine leak. We've seen this before: pointfreeco/swift-composable-architecture#195. I believe this has been fixed now, but up until Xcode 12.x if you concatenated a MergeMany you would get a leak. Maybe something like that is going again :/ |
Is merging the same as concatenating? In Xcode 12.3 I'm having memory leaks when using |
@rjantz2 |
Is this Combine bug the one reported here? Do you have a workaround? |
Since this is related to composable-core-location I've transferred the issue here. I think one potential fix would be for |
Description
Hey guys,
first of all, I would like to thank you both for making such a great library. Working with it is a lot of fun! 🥇
I believe, however, that I've found a memory leak when composable architecture is combined with the composable core location dependency in a very specific way. I've prepared a mini demo for you and I would really appreciate it if you'll have time to check it out. It is available here.
To Reproduce
Simulator -> Features -> Location -> City Run
CLLocation
objects are leaking (image attached)After investigating, I've found out that if I don't combine
reducerA
into the "main"appReducer
, location objects stop leaking. I.e. using just one pulled back child reducer with a core location dependency inside of.combined
block works fine. But as soon as you add another "scoped" reducer, the issue reappears. You can reproduce this "fix" by commenting out the following code.The other strange thing that it seems like it also helps is if you remove the map function from the
didUpdateLocations
method in the core location dependency and only use the last location.Change from:
to:
Expected behavior
CLLocation
objects should not leak.Screenshots
Environment
Thanks for your help in advance. I hope that I am not wasting your time by misusing the library 😄
The text was updated successfully, but these errors were encountered: