auth0/Lock.swift

Memory leaks / retain cycles

ejensen opened this issue · 1 comments

Describe the problem

Lock's UI leaks memory. The leaks are caused by retain cycles.

memory-leaks

What was the expected behavior?

Lock does not leak memory

Reproduction

Memory is leaked when the Lock UI is dismissed:

  • Run the Lock demo app
  • Present the Lock UI
  • Dismiss the Lock UI
  • Notice that memory is leaked
    • For instance, the Presenter is never deallocated
Presenter-leaks.mp4

Memory is leaked when switching between log in and sign up:

  • Run the Lock demo app
  • Present the Lock UI
  • Switch between the login and sign up views
  • Notice that the view's memory is leaked
    • For instance, a new CredentialsView is created each time the login view is shown, but never deallocated
View-leaks.mp4

Can the behavior be reproduced using the included Lock.swift demo app? Yes

Environment

  • Version of Lock.swift used: 2.21.0
  • Version of iOS: 14.4
  • Version of Xcode: 12.4

@ejensen Thanks for raising this, I'll be taking a look.