仪器报告错误内存泄漏?
我在 iPad 应用程序上运行 Instruments 来检查是否存在泄漏。它发现了方法中保留对象的多个“泄漏”:
alt text http://cl.ly/ a85d3d8bdc6286c8de71/content
但是这些对象稍后在 dealloc 中释放:
alt text http://cl.ly/ a265f76a538ee55781df/content
这些是否被归类为误报?
I ran Instruments on my iPad app to check for leaks. It found several "leaks" where an object was being retained in a method:
alt text http://cl.ly/a85d3d8bdc6286c8de71/content
But these objects are released later in dealloc:
alt text http://cl.ly/a265f76a538ee55781df/content
Are these classified as false-positives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
self.detailPopover 是用保留声明的属性吗?如果是这样,那么 self.detailPopover 赋值将导致生成的 set 方法对从您已拥有的 alloc 返回的对象调用保留。
如果它是保留属性,则从分配中删除 self,这样 set 方法就不会被调用,并且您的保留计数将是正确的。
或者避免生成的 set 方法并保留...
Is self.detailPopover a property declared with retain? If so then the assignment self.detailPopover will result in the generated set method calling retain on the object returned from alloc that you already own.
If it is a retained property then remove self from the assignment so the set method is not called and your retain count will be correct.
or avoid the generated set method and it's retain...