【发布时间】:2013-12-11 18:09:41
【问题描述】:
泄漏工具警告我与这部分代码相关的内存泄漏:
[self.contview addSubview:nav.view];
以下是我管理视图的方式:
[nav.view removeFromSuperview];
self.nav = [[[destinationClass alloc] initWithNibName:pagename bundle:nil] autorelease];
[self.contview addSubview:nav.view];
self.nav 刚分配完之后,retainCount 为 2 正常吗?会不会和内存泄露有关?
我对内存管理很陌生,有人可以帮我吗?
非常感谢
【问题讨论】:
-
你能发布所有相关的代码吗?这一切对我来说看起来有点奇怪,但没有上下文就很难说。
-
www.whentouseretaincount.com --
retainCount无关紧要。使用分配工具查看每个保留/释放事件的堆栈跟踪。
标签: ios iphone objective-c memory-leaks