Problem description
There are set of functions to work with Screen Effects in https://github.com/ikarenkov/Modo/blob/dev/modo-compose/src/main/java/com/github/terrakok/modo/lifecycle/ScreenEffects.kt . Unfortunately, improper usage of these functions can lead to memory leaks, because under the hood we store dependency for the screen that captures lambda passed to function. If you pass any object, which lifetime is shorter than lifetime of screen, it is gonna be freed only when screen is disposed.
Problem description
There are set of functions to work with Screen Effects in https://github.com/ikarenkov/Modo/blob/dev/modo-compose/src/main/java/com/github/terrakok/modo/lifecycle/ScreenEffects.kt . Unfortunately, improper usage of these functions can lead to memory leaks, because under the hood we store dependency for the screen that captures lambda passed to function. If you pass any object, which lifetime is shorter than lifetime of screen, it is gonna be freed only when screen is disposed.
WeakRefferenceto prove it