0

I saw this thread here, and I am suspicious that I have the problem where stuff is happening on background threads and ARC isn't taking care of it the way it should. I am using the Parse sdk which saves and finds objects to and from the database all in the background using calls like [myObject saveInBackground] or [myObject saveEventually]. I don't have access to the source to edit these methods to include @autoreleasepool. And I am assuming that if I try to do something like this:

@autoreleasepool{
  [myObject saveInBackground];
  [myObject2 saveEventually];
}

that it will still be doing the autoreleasepool on the main thread and not the background thread.

Every once in a while my app crashes and there isn't really a pattern which is why I think it's a memory issue but I am using ARC and at a loss as to why I am getting sporatic crashes.

edit * here is the crash log. This is my first time looking at these. Go easy on me.

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
Community
  • 1
  • 1
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
  • 2
    Memory leaks don't cause crashes (except if your app is being killed for using too much memory). You should post the crash log, it should be much clearer what's going on from that. – Catfish_Man Jan 03 '13 at 00:15
  • 1
    Yeah, sounds like you need to figure out the cause of your crashes first. And if you really think it's a leak, use the leaks tool in Instruments to track it down. – Jon Shier Jan 03 '13 at 00:16
  • I have the same problem. I also couldn't find this `PFNetworkingUtils.m` file in their repository. What's the deal with it? – Iulian Onofrei Jan 07 '16 at 15:05

0 Answers0