我在这里看到了这个线程,我怀疑我的问题是后台线程上发生了一些事情,而 ARC 没有按应有的方式处理它。我正在使用 Parse sdk,它使用 [myObject saveInBackground] 或 [myObject saveEventually] 等调用在后台保存和查找数据库中的对象。我无权访问源来编辑这些方法以包含@autoreleasepool。我假设如果我尝试做这样的事情:
@autoreleasepool{
[myObject saveInBackground];
[myObject2 saveEventually];
}
它仍然会在主线程而不是后台线程上执行自动释放池。
每隔一段时间,我的应用程序就会崩溃,并且没有真正的模式,这就是为什么我认为这是一个内存问题,但我正在使用 ARC 并且不知道为什么我会偶尔崩溃。
编辑 * 这里是崩溃日志。这是我第一次看这些。对我放轻松。
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
com.graphiteGames.Capture-This failed to launch in time
Elapsed total CPU time (seconds): 6.470 (user 6.470, system 0.000), 32% CPU
Elapsed application CPU time (seconds): 0.745, 4% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x33fc40fc __psynch_mutexwait + 24
1 libsystem_c.dylib 0x35438124 pthread_mutex_lock + 388
2 Capture This 0x000dcb62 -[PFObject objectId] (PFObject.m:1174)
3 Capture This 0x000c67a4 -[RootTableView refreshGameData] (RootTableView.m:78)
4 Capture This 0x000c6362 -[RootTableView viewDidLoad] (RootTableView.m:33)
5 UIKit 0x37f1d588 -[UIViewController loadViewIfRequired] + 360
6 UIKit 0x37f7212e -[UIViewController contentScrollView] + 22
7 UIKit 0x37f72074 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 24
8 UIKit 0x37f71f58 -[UINavigationController _layoutViewController:] + 28
9 UIKit 0x37f71e7c -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 268
10 UIKit 0x37f715bc -[UINavigationController _startTransition:fromViewController:toViewController:] + 60
11 UIKit 0x37f714a4 -[UINavigationController _startDeferredTransitionIfNeeded:] + 320
12 UIKit 0x37f424dc -[UILayoutContainerView layoutSubviews] + 176
13 UIKit 0x37f017fe -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 254
14 QuartzCore 0x30db5d5e -[CALayer layoutSublayers] + 210
15 QuartzCore 0x30db58fc CA::Layer::layout_if_needed(CA::Transaction*) + 456
16 QuartzCore 0x30de47a2 -[CALayer layoutIfNeeded] + 138
17 UIKit 0x37fab0c4 -[UIViewController window:setupWithInterfaceOrientation:] + 204
18 UIKit 0x37faa2b0 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 3616
19 UIKit 0x37fa9482 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 42
20 UIKit 0x37fa940c -[UIWindow _setRotatableViewOrientation:duration:force:] + 64
21 UIKit 0x380df17c __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 100
22 UIKit 0x37f67676 -[UIWindow _updateToInterfaceOrientation:duration:force:] + 214
23 UIKit 0x37f673b8 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 688
24 UIKit 0x37f66d26 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 154
25 UIKit 0x37f5de9e -[UIWindow addRootViewControllerViewIfPossible] + 366
26 UIKit 0x37f59ae0 -[UIWindow _setHidden:forced:] + 360
27 UIKit 0x37f9b1c4 -[UIWindow makeKeyAndVisible] + 56
28 UIKit 0x37f5e832 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1662
29 UIKit 0x37f5683e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
30 UIKit 0x37efec34 -[UIApplication handleEvent:withNewEvent:] + 1000
31 UIKit 0x37efe6c8 -[UIApplication sendEvent:] + 68
32 UIKit 0x37efe116 _UIApplicationHandleEvent + 6150
33 GraphicsServices 0x34b1e5a0 _PurpleEventCallback + 588
34 GraphicsServices 0x34b1e1ce PurpleEventCallback + 30
35 CoreFoundation 0x35e34170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
36 CoreFoundation 0x35e34112 __CFRunLoopDoSource1 + 134
37 CoreFoundation 0x35e32f94 __CFRunLoopRun + 1380
38 CoreFoundation 0x35da5eb8 CFRunLoopRunSpecific + 352
39 CoreFoundation 0x35da5d44 CFRunLoopRunInMode + 100
40 UIKit 0x37f55478 -[UIApplication _run] + 664
41 UIKit 0x37f522f4 UIApplicationMain + 1116
42 Capture This 0x000bde2e main (main.m:16)
43 Capture This 0x000bdde4 0xbb000 + 11748
Thread 1 name: Dispatch queue: com.apple.root.default-priority
Thread 1:
0 libsystem_kernel.dylib 0x33fc408c __psynch_cvwait + 24
1 libsystem_c.dylib 0x35440d2a _pthread_cond_wait + 642
2 libsystem_c.dylib 0x3544af14 pthread_cond_wait + 36
3 Foundation 0x3592aa4c -[__NSOperationInternal waitUntilFinished] + 144
4 Capture This 0x00121fe0 -[PFNetworkCommandRunner runInOperation:callback:] (PFNetworkCommandRunner.m:84)
5 Capture This 0x001227ee -[PFRetryingCommandRunner runInOperation:callback:] (PFRetryingCommandRunner.m:52)
6 Capture This 0x0012358a -[PFOperation runInThisThread:] (PFOperation.m:32)
7 Capture This 0x000db486 -[PFObject(Private) fetchWithLocking:error:] (PFObject.m:942)
8 Capture This 0x000ebd1e -[PFUser fetchWithLocking:error:] (PFUser.m:1001)
9 Capture This 0x000dedf4 __39-[PFObject fetchInBackgroundWithBlock:]_block_invoke_0 (PFObject.m:1500)
10 Capture This 0x00111686 __25-[PFBackgroundTask start]_block_invoke_0 (PFBackgroundTask.m:59)
11 libdispatch.dylib 0x34a6e11c _dispatch_call_block_and_release + 8
12 libdispatch.dylib 0x34a7c254 _dispatch_root_queue_drain + 256
13 libdispatch.dylib 0x34a7c3b4 _dispatch_worker_thread2 + 80
14 libsystem_c.dylib 0x3543da0e _pthread_wqthread + 358
15 libsystem_c.dylib 0x3543d8a0 start_wqthread + 4
Thread 2 name: Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0 libsystem_kernel.dylib 0x33fb4648 kevent64 + 24
1 libdispatch.dylib 0x34a7d4ec _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x34a6fdf4 _dispatch_mgr_thread$VARIANT$up + 32
Thread 3 name: Dispatch queue: com.apple.root.default-priority
Thread 3:
0 libsystem_kernel.dylib 0x33fb3f04 semaphore_wait_trap + 8
1 libdispatch.dylib 0x34a7c82a _dispatch_semaphore_wait_slow + 178
2 libxpc.dylib 0x34eab5d2 xpc_connection_send_message_with_reply_sync + 150
3 SystemConfiguration 0x390895fe _reach_server_target_status + 334
4 SystemConfiguration 0x3908a2ca __SCNetworkReachabilityServer_targetStatus + 38
5 SystemConfiguration 0x3906a626 __SCNetworkReachabilityGetFlags + 318
6 SystemConfiguration 0x3906afec SCNetworkReachabilityGetFlags + 212
7 Capture This 0x001049c0 -[PFCommandCache init] (PFCommandCache.m:87)
8 Capture This 0x00104638 +[PFCommandCache defaultInstance] (PFCommandCache.m:34)
9 Capture This 0x000f3f24 __36+[Parse setApplicationId:clientKey:]_block_invoke_0 (Parse.m:40)
10 libdispatch.dylib 0x34a6e11c _dispatch_call_block_and_release + 8
11 libdispatch.dylib 0x34a7c254 _dispatch_root_queue_drain + 256
12 libdispatch.dylib 0x34a7c3b4 _dispatch_worker_thread2 + 80
13 libsystem_c.dylib 0x3543da0e _pthread_wqthread + 358
14 libsystem_c.dylib 0x3543d8a0 start_wqthread + 4
Thread 4 name: WebThread
Thread 4:
0 libsystem_kernel.dylib 0x33fb3eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x33fb4048 mach_msg + 36
2 CoreFoundation 0x35e34040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x35e32d9e __CFRunLoopRun + 878
4 CoreFoundation 0x35da5eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x35da5d44 CFRunLoopRunInMode + 100
6 WebCore 0x31a8aa40 _ZL12RunWebThreadPv + 440
7 libsystem_c.dylib 0x3544830e _pthread_start + 306
8 libsystem_c.dylib 0x354481d4 thread_start + 4
Thread 5:
0 libsystem_kernel.dylib 0x33fb3eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x33fb4048 mach_msg + 36
2 CoreFoundation 0x35e34040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x35e32d9e __CFRunLoopRun + 878
4 CoreFoundation 0x35da5eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x35da5d44 CFRunLoopRunInMode + 100
6 Foundation 0x358df78a -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7 Foundation 0x35983058 -[NSRunLoop(NSRunLoop) run] + 76
8 Capture This 0x0011556a +[PFNetworkingUtils networkThreadMain] (PFNetworkingUtils.m:32)
9 Foundation 0x3598c678 __NSThread__main__ + 968
10 libsystem_c.dylib 0x3544830e _pthread_start + 306
11 libsystem_c.dylib 0x354481d4 thread_start + 4
Thread 6:
0 libsystem_kernel.dylib 0x33fb3eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x33fb4048 mach_msg + 36
2 CoreFoundation 0x35e34040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x35e32d9e __CFRunLoopRun + 878
4 CoreFoundation 0x35da5eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x35da5d44 CFRunLoopRunInMode + 100
6 Foundation 0x358df78a -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7 Foundation 0x35983058 -[NSRunLoop(NSRunLoop) run] + 76
8 Capture This 0x00128ec0 +[PF_AFURLConnectionOperation networkRequestThreadEntryPoint:] (PF_AFURLConnectionOperation.m:151)
9 Foundation 0x3598c678 __NSThread__main__ + 968
10 libsystem_c.dylib 0x3544830e _pthread_start + 306
11 libsystem_c.dylib 0x354481d4 thread_start + 4
Thread 7 name: com.apple.NSURLConnectionLoader
Thread 7:
0 libsystem_kernel.dylib 0x33fb3eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x33fb4048 mach_msg + 36
2 CoreFoundation 0x35e34040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x35e32d9e __CFRunLoopRun + 878
4 CoreFoundation 0x35da5eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x35da5d44 CFRunLoopRunInMode + 100
6 Foundation 0x35908bc8 +[NSURLConnection(Loader) _resourceLoadLoop:] + 304
7 Foundation 0x3598c678 __NSThread__main__ + 968
8 libsystem_c.dylib 0x3544830e _pthread_start + 306
9 libsystem_c.dylib 0x354481d4 thread_start + 4
Thread 8:
0 libsystem_kernel.dylib 0x33fc4d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x3543dcf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x3543da12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x3543d8a0 start_wqthread + 4
Unknown thread crashed with unknown flavor: 5, state_count: 1