你如何找出保留仪器中物体的内容? [英] How do you find out what is retaining an object in Instruments?

查看:62
本文介绍了你如何找出保留仪器中物体的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的iOS项目转换为ARC。其中一个视图控制器没有调用它的dealloc方法,并且没有按照仪器进行解除分类。

I've recently converted my iOS project over to ARC. One of the view controllers is not calling its dealloc method and is not being dealloc'ed according to Instruments.

我已经仔细检查了所有属性并设置了相应的属性弱者。我还确保将视图控制器作为委托的任何内容都在viewWillDisappear上取消设置,但视图仍然在内存中保留。

I've double checked all of my properties and set the appropriate ones to weak. I've also made sure that anything that has the view controller as a delegate has it unset on viewWillDisappear but the view still sticks around in memory.

我是新手在仪器上:我怎么知道保留这个观点的是什么?

I'm a newbie at Instruments: how can I tell what is retaining this view?

推荐答案

如果你真的被卡住并且程序很复杂(或者抽象,在ARC的情况下,你可以带出大炮:

Well if you are really stuck and the program is complex (or abstracted, in the case of ARC), you can bring out the cannons:


  • 打开你的Xcode项目

  • 选择可执行文件(如果需要)

  • cmd + i (个人资料)

  • 选择Le Wizard中的'泄漏'工具(如果需要)

  • 按Return键开始分析

  • 锻炼你的应用

  • 在工具中按停止

  • 确认已选择分配工具

  • 单击并按住名为的弹出按钮'统计'

  • 选择对象列表项

  • 找到您之间的分配在对象列表中的记录之中

  • 选择该分配/对象

  • 单击地址右侧的详细箭头该分配的表格视图单元格

  • 现在您可以看到与分配相关的所有事件(分配,免费,引用计数操作)

  • cmd + shift + e for Extended Detail

  • 浏览此列表中的事件,找到您寻求的不平衡。

  • Open your Xcode project
  • Choose the executable (if needed)
  • Press cmd+i (Profile)
  • Choose the 'Leaks' Instrument in Le Wizard (if needed)
  • Press Return to begin profiling
  • Exercise your app
  • Press 'Stop' in Instruments
  • Verify the 'Allocations' instrument is selected
  • Click and Hold the Popup Button named 'Statistics'
  • Select the Objects List item
  • Locate the allocation you are interested in, among the records in the Objects List
  • Select that allocation/object
  • Click the 'detail arrow' to the right of the address in the table view cell of that allocation
  • Now you see all events related to the allocation (allocation, free, reference count operations)
  • Press cmd+shift+e for Extended Detail
  • Go through the events in this list, and locate the imbalance you seek.

这篇关于你如何找出保留仪器中物体的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆