swift pushViewController内存

时间:2014-07-28 13:03:54

标签: ios memory-leaks swift

我正在使用以下代码将新的视图控制器推入堆栈,ViewController使用nib初始化并且仅包含webview,该类完全为空。

    var profileVC = GenericWebViewController()
    profileVC.initWithURL(url)
    navigationController.pushViewController(profileVC, animated:true)

按下视图时,内存使用量会增加,但是,按下后退按钮时,内存级别不会下降。

如何收集profileVC垃圾?

1 个答案:

答案 0 :(得分:1)

没什么;)

自动引用计数会自动为您处理

http://clang.llvm.org/docs/AutomaticReferenceCounting.html

编辑:由于其他原因,内存可能不会出现故障。检查您没有strong reference cycles。要100%确定您的GenericWebViewController正在从内存中清除,请覆盖其dealloc方法并确保它被调用。

另请查看leaks instrument