Closed DevTchernov closed 4 years ago
why you think that it should be in ViewModel
? maybe just global fun in ios-specific part?
so i add GC.collect
to onCleared
of ViewModel
in ios...it will be automatically
merged
I have a question about this: Why do you think GC.collect()
is needed here? Isn't the garbage collection called automatically by Kotlin anyways?
hi. we found that GC of Kotlin/Native not syncronized with swift part memory management. it's bring us to high memory usage, when swift part have many object and K/N not call GC yet, because think that it can wait.
another reason is that in swift part ios developers sometimes use deinit
function with some logic and expect that this logic will be called immediately but if object was catched by Kotlin/Native this call will be delayed, wait for GC.
with automatically call GC.collect we solve for us both problems
Same as follow: