编辑:我找到了这次崩溃的原因!bbum 指出缓冲区溢出是一个非常常见的原因,所以我查看了我拥有的唯一缓冲区类型 malloc:
closedList = (AINavigationCell **)malloc(baseCells.count * sizeof(AINavigationCell *));
我后来覆盖了超出数组边界的数据,它应该比baseCells.count
. 谢谢你!
问题:
我在 -drainEXC_BAD_ACCESS
期间有一个可复制的NSAutoreleasePool
,这似乎表明我过度释放了一个对象。所以我启用NSZombie
了,但程序不再崩溃。我也没有将任何信息记录到控制台。如果我关闭 NSZombie,崩溃会再次出现。这是什么意思?我认为 NSZombies 正是用来解决这类问题的。如果 NSZombie 没有帮助,还有其他方法可以询问这个过度释放的对象吗?
此外,在模拟器上无法重现崩溃,这就是为什么我不能将 Instruments 与 NSZombie 一起使用。
以下是崩溃点的回溯。
#0 0x31ac8bc8 in _cache_fill ()
#1 0x31acaf8e in lookUpMethod ()
#2 0x31ac8780 in _class_lookupMethodAndLoadCache ()
#3 0x31ac859a in objc_msgSendSuper_uncached ()
#4 0x328014f0 in -[__NSArrayReverseEnumerator dealloc] ()
#5 0x327b1f7a in -[NSObject(NSObject) release] ()
#6 0x327b63c8 in CFRelease ()
#7 0x327b58de in _CFAutoreleasePoolPop ()
#8 0x320e132c in NSPopAutoreleasePool ()
#9 0x30899048 in CAPopAutoreleasePool ()
#10 0x30902784 in CA::Display::DisplayLink::dispatch ()
#11 0x309027ea in CA::Display::IOMFBDisplayLink::callback ()
#12 0x30076bfa in IOMobileFramebufferVsyncNotifyFunc ()
#13 0x333dee6a in IODispatchCalloutFromCFMessage ()
#14 0x327e8be6 in __CFMachPortPerform ()
#15 0x327e06fe in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#16 0x327e06c2 in __CFRunLoopDoSource1 ()
#17 0x327d2f7c in __CFRunLoopRun ()
#18 0x327d2c86 in CFRunLoopRunSpecific ()
#19 0x327d2b8e in CFRunLoopRunInMode ()
#20 0x3094a4aa in GSEventRunModal ()
#21 0x3094a556 in GSEventRun ()
#22 0x32c14328 in -[UIApplication _run] ()
#23 0x32c11e92 in UIApplicationMain ()
#24 0x00002556 in main (argc=1, argv=0x2fdff660) at /Users/hyn/Desktop/MyProject-trunk/main.m:14