title: NSRunloop runUntilDate causes application crash
body: <p>I have an application which runs for days and weeks on a Snow Leopard server.
  It uses <code>-[NSRunLoop runUntilDate:]</code> 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:</p>
  
  <p><strong>Crash Report</strong></p>
  
  <pre><code>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
  </code></pre>
  
  <p>At first glance I thought my <code>NSRunLoop</code> object is no longer valid and therefore the <code>release</code> message deep within CF causes a crash. However, I don't think that's the case as 
  I obtain the reference to the <code>currentRunLoop</code> object in the line before.</p>
  
  <p>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.</p>
  
  <p>EDIT: <strong>problem solve - please see my answer below</strong></p>