0

I have this view hierarchy

  • RouterDashboardViewController : RootViewController

  • RootViewController : UIViewController

Currently, RouterDashboardViewController instance is in the navigation stack. When I reset rootViewController of NavigationController then RouerDashboardInstance still exist in memory because I can check my deinit{} method not gets called.Below are the stack traces in Instruments but am not able to detect any reason why my RouterDashboard instance not get deallocated. I am sure there will be retain cycles which keeps RouterDashboard instance still alive. One more thing am not understanding these stack traces because ViewDidLoad() method called several times.Stack Traces of Instruments

Sumit Jangra
  • 651
  • 5
  • 16

1 Answers1

0

Something has a strong reference to RouterDashboardViewController. A few things to check…

  • Are you assigning it to a variable?

    • You may need to declare it as weak var …
  • Is it a delegate of another class?

    • Make sure delegate properties are also weak vars
  • Does it use any closures that refer it self?

    • Add a capture list to your closure's parameter list ([unowned self] or [weak self] )
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160