Skip to content

Improper usage of screen effects can lead to memory leaks #67

Description

@ikarenkov

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.

  • Provide POC of object leaking, using WeakRefference to prove it
  • Deprecate such functions
  • Provide instructions how to achieve similar behaviour without such leaking

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions