coolcat
06/25/2020, 3:32 PMWeakReference
to hold a reference to a View object from Kotlin, to try and avoid memory leaks. But these objects do not seem to get deallocated immediately when they go out of scope. This is annoying for me as I use iOS UIViewController
as the view object, and the expectation is that these will have deinit
called as soon as they are dismissed.
I have tried the project icerockdev/moko-mvvm
. In their iOS sample project sample6
, the memory leak does not seem to occur, and the view has deinit
invoked immediately. I have read the moko-mvvm
source code and I think their implementation is the same as mine. I can’t understand this.wingchi
06/25/2020, 7:06 PMnil
in Swift when your ViewController
calls deinit
if that’s a concern for you.coolcat
06/26/2020, 6:07 AMdeinit
is never called because my Kotlin class is clinging on to a reference to it.Peter Hsu
06/28/2020, 11:38 PM