iOS 内存错误调试(EXC_BAD_ACCESS)

内存错误crash现场:ios

Thread堆栈:xcode

有多是访问被释放对象形成,根据现场并不能找到具体哪一个对象出现内存错误。app

1.开启僵尸对象调试this

Edit Scheme->Debug->Diagnostics->Enable Zombie Objectsspa

2.闪退后查看控制台,看输出应该是某个Button出错调试

2016-10-14 16:40:49.959 funmiosbr_ZQB[2761:388881] *** -[UIButton setHidden:]: message sent to deallocated instance 0x185942a0

3.因为新版xcode默认调试器为lldb,旧版本gdb调试器可使用以下命令查看code

(gdb) info malloc-history 0x185942a0

(1)Profile your project对象

(2)Select Zombies from the list of instrumentsblog

(3)Make your app trigger the problem内存

(4)At this point you should be presented with the address that was already deallocated and you can explore it.

(5)定位问题

相关文章
相关标签/搜索