manishkkatoch / SimpleTwoWayBindingIOS

An ultra light, ultra simple two way binding library for IOS and Swift.
MIT License
165 stars 48 forks source link

Memory Leak? #12

Open n13 opened 5 years ago

n13 commented 5 years ago

I noticed that there's no support for removing an observer, and observers are held in an array.

That means that over time, as more and more views are used, the array of observers fills up with more and more items - hopefully the blocks used did not reference anything big, using weak self and so on should keep it small.

Still, I need to be able to remove observers.

Then observers could be added / removed when views willShow / willHide

iosparesh commented 4 years ago

Have same issue, due to that my viewmodel does not get released. and memory increasing. please suggest a way

fweez commented 4 years ago

@manishkkatoch For what it's worth, I had to fix this issue for our app. The changes I made are pretty significant -- the bulk of them are here https://github.com/ridewithgps/SimpleTwoWayBindingIOS/commit/52650c2df81bba8907af04c36f6b2c72d2180e65 -- but I could spend some time working on a smaller PR to push the changes back here, if you'd like.

If you'd like to take this discussion off GitHub, please email me at ryan@ridewithgps.com

malhal commented 4 years ago

An unbind method requested in https://github.com/manishkkatoch/SimpleTwoWayBindingIOS/issues/4 might solve this.