I have an application which runs for days and weeks on a Snow Leopard server.
It uses -[NSRunLoop runUntilDate:]
to "pause" for ten seconds, perform its task and then pause again. After running for over one hour, my app crashes with the following report:
Crash Report
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000013
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
objc_msgSend() selector name: release
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff84cfef0c objc_msgSend + 40
1 com.apple.CoreFoundation 0x00007fff84e363d1 __CFRunLoopDoSources0 + 1361
2 com.apple.CoreFoundation 0x00007fff84e345c9 __CFRunLoopRun + 873
3 com.apple.CoreFoundation 0x00007fff84e33d8f CFRunLoopRunSpecific + 575
4 com.apple.Foundation 0x00007fff83e73b74 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 270
5 com.apple.Foundation 0x00007fff83ebf19a -[NSRunLoop(NSRunLoop) runUntilDate:] + 78
At first glance I thought my NSRunLoop
object is no longer valid and therefore the release
message deep within CF causes a crash. However, I don't think that's the case as
I obtain the reference to the currentRunLoop
object in the line before.
The crash time varies between 1 and 1.5hrs but I can't get a handle on what's causing it. Any comments or opinions or debugging ideas would be greatly appreciated as I'm not sure what to do next.
EDIT: problem solve - please see my answer below