[英]ViewController not released from Memory
I have this view hierarchy 我有这个视图层次
RouterDashboardViewController : RootViewController
RouterDashboardViewController:RootViewController
RootViewController : UIViewController
RootViewController:UIViewController
Currently, RouterDashboardViewController instance is in the navigation stack. 当前,RouterDashboardViewController实例在导航堆栈中。 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. 当我重置NavigationController的rootViewController时,由于可以检查我的
deinit{}
方法没有被调用,因此RouerDashboardInstance仍然存在于内存中。下面是Instruments中的堆栈跟踪,但无法检测到我的RouterDashboard实例未释放的任何原因。 I am sure there will be retain cycles which keeps RouterDashboard instance still alive. 我确信会有保留周期,使RouterDashboard实例保持活动状态。 One more thing am not understanding these stack traces because ViewDidLoad() method called several times.
还有一件事是不了解这些堆栈跟踪信息,因为ViewDidLoad()方法被调用了几次。
Something has a strong reference to RouterDashboardViewController
. 某些东西对
RouterDashboardViewController
有很强的参考RouterDashboardViewController
。 A few things to check… 需要检查的几件事...
Are you assigning it to a variable? 您是否将其分配给变量?
weak var …
weak var …
Is it a delegate of another class? 是另一堂课的代表吗?
weak var
s weak var
Does it use any closures that refer it self
? 它是否使用任何引用
self
闭包?
[unowned self]
or [weak self]
) [unowned self]
或[weak self]
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.