views:

176

answers:

1

I am working on an app that tracks a users location. After about 20 minutes it seems that the app always crashes, and I am not sure why. Device logs show:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x069f6000
Crashed Thread:  0

Thread 0 Crashed:
0   Ride                            0x00012e00 -[Route addCoordinate:] (Route.m:92)
1   Ride                            0x0000877a -[MyRidesMapViewController locationManager:didUpdateToLocation:fromLocation:] (MyRidesMapViewController.m:528)
2   CoreLocation                    0x0000931c -[CLLocationManager onClientEventLocation:] + 584
3   CoreLocation                    0x00007552 -[CLLocationManager onClientEvent:supportInfo:] + 98
4   CoreLocation                    0x000076a0 OnClientEvent + 16
5   CoreLocation                    0x00002ade CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
6   CoreLocation                    0x0000512c CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 204
7   CoreLocation                    0x0000528a CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 298
8   CoreFoundation                  0x0006936a __CFMessagePortPerform + 242
9   CoreFoundation                  0x00071aa4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
10  CoreFoundation                  0x00073848 __CFRunLoopDoSource1 + 160
11  CoreFoundation                  0x00074626 __CFRunLoopRun + 514
12  CoreFoundation                  0x0001d8e4 CFRunLoopRunSpecific + 224
13  CoreFoundation                  0x0001d7ec CFRunLoopRunInMode + 52
14  GraphicsServices                0x000036e8 GSEventRunModal + 108
15  GraphicsServices                0x00003794 GSEventRun + 56
16  UIKit                           0x000062a0 -[UIApplication _run] + 396
17  UIKit                           0x00004e10 UIApplicationMain + 664
18  Ride                            0x00002a20 main (main.m:14)
19  Ride                            0x000029d4 start + 32

Looks like I am trying to release something that has already been released, but what?! I have NSZombie enabled, and it does not seem to help.

It used to work, and I recently updated my class to use self. for anything that I synthesized, could this be the issue?

EDIT: I updated the error. It seems to be listing the line numbers for each line, but they do not seem to be helping to find the issue.

A: 

Do you have NSZombie enabled while you're running on the device? If so chances are you are running out of memory. As you know, NSZombie keeps released objects around so you can detect a double release.

Chances are you do have some memory issues though. Does the static analyzer show you anything? (shift-command-A).

Adam Eberbach
You know what, I do! Crap, let me turn that off and see my issues go away.And yes, using the static analyzer does show some issues that I will work on...
Nic Hubbard
OK... post samples of code that the analyzer is complaining about if the solution isn't obvious.
Adam Eberbach
Ok, removing NSZombie did not help. I updated the post above with the updated error. Still seems like it has to do with locations, and maybe drawing my route on the map.
Nic Hubbard
Looks like the analyzer found something I wasn't releasing, will try out the app again to see if this fixed the issue...
Nic Hubbard
You have a location manager delegate function called right before your crash. Are you perhaps releasing that delegate without making CLLocationManager's delegate nil? Are you getting a call to that method unexpectedly, when things are in a bad state? Do you have a separate timer maybe to be able to display a dialog if CLLocationManager fails to respond in time, and it is being invalidated when not active?
Adam Eberbach
@Adam: I am setting my locationManager object to nil in my dealloc method. I am drawing a line on the route that the user location takes. So, that method is getting updated and redrawn each time there is a location update...
Nic Hubbard
You marked it solved - what was it?
Adam Eberbach
I'm experiencing almost the same exact problem. Please let us know what the solution was.
sw