自动释放池崩溃应用程序
我的自动释放池随机崩溃了我的应用程序,此问题的常见原因是什么?
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x0145ba63 objc_msgSend + 23
1 CoreFoundation 0x01210a6c CFRelease + 92
2 CoreFoundation 0x012f2e8a -[__NSArrayM dealloc] + 170
3 CoreFoundation 0x01210a6c CFRelease + 92
4 CoreFoundation 0x01235b8d _CFAutoreleasePoolPop + 237
5 Foundation 0x0005886c __NSFireDelayedPerform + 559
6 CoreFoundation 0x012dafe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
7 CoreFoundation 0x012dc594 __CFRunLoopDoTimer + 1220
8 CoreFoundation 0x01238cc9 __CFRunLoopRun + 1817
9 CoreFoundation 0x01238240 CFRunLoopRunSpecific + 208
10 CoreFoundation 0x01238161 CFRunLoopRunInMode + 97
11 GraphicsServices 0x01c2e268 GSEventRunModal + 217
12 GraphicsServices 0x01c2e32d GSEventRun + 115
13 UIKit 0x002e842e UIApplicationMain + 1160
14 FancyAPint 0x000029e8 main + 102 (main.m:14)
15 FancyAPint 0x00002979 start + 53
我知道这是因为一个对象被过度释放,我认为在自动释放池尝试释放它之前对象被释放是正确的吗?因此自动释放池试图过度释放对象?
My autorelease pool is crashing my app at random, what is the common cause of this problem?
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x0145ba63 objc_msgSend + 23
1 CoreFoundation 0x01210a6c CFRelease + 92
2 CoreFoundation 0x012f2e8a -[__NSArrayM dealloc] + 170
3 CoreFoundation 0x01210a6c CFRelease + 92
4 CoreFoundation 0x01235b8d _CFAutoreleasePoolPop + 237
5 Foundation 0x0005886c __NSFireDelayedPerform + 559
6 CoreFoundation 0x012dafe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
7 CoreFoundation 0x012dc594 __CFRunLoopDoTimer + 1220
8 CoreFoundation 0x01238cc9 __CFRunLoopRun + 1817
9 CoreFoundation 0x01238240 CFRunLoopRunSpecific + 208
10 CoreFoundation 0x01238161 CFRunLoopRunInMode + 97
11 GraphicsServices 0x01c2e268 GSEventRunModal + 217
12 GraphicsServices 0x01c2e32d GSEventRun + 115
13 UIKit 0x002e842e UIApplicationMain + 1160
14 FancyAPint 0x000029e8 main + 102 (main.m:14)
15 FancyAPint 0x00002979 start + 53
I know this is because an object is being over released, am i correct in thinking an object is being released before the autorelease pool is trying to release it. Therefore the autorelease pool attempts to over release an object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的评价是正确的。尝试使用模拟器中的“Zombies”工具运行您的应用程序,或将 NSZombieEnabled 环境变量设置为 YES。这些都将为您提供有关哪些对象被过度释放的更多信息。
Your assessment is correct. Try running your app using the "Zombies" instrument in the simulator, or setting the NSZombieEnabled environmental variable to YES. These will both give you more information about what objects are being overreleased.
这是因为额外的内存释放。不要释放在自动释放池中分配并从拥有自己的内存的对象初始化的对象。这可能是这背后的一个原因,因为我也遇到了这个问题。
This will be because of extra memory releases. Do not release the object which is being allocated inside auto-release pool and is inited from object which has its own memory. This may the one reason behind this as i also faced this problem.