自动释放池崩溃应用程序

发布于 2024-10-12 12:46:44 字数 1335 浏览 7 评论 0原文

我的自动释放池随机崩溃了我的应用程序,此问题的常见原因是什么?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

°如果伤别离去 2024-10-19 12:46:44

你的评价是正确的。尝试使用模拟器中的“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.

故人的歌 2024-10-19 12:46:44

这是因为额外的内存释放。不要释放在自动释放池中分配并从拥有自己的内存的对象初始化的对象。这可能是这背后的一个原因,因为我也遇到了这个问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文