Re: NSTimer memory management
Re: NSTimer memory management
Thanks all for the input. I'll take Scott's and Gregory's advice to
not retain the timer. I've seen this advocated before, but always felt
uneasy about not retaining my pointers. It just goes against all I
ever learned about Cocoa.
In this particular case, though, I might just as well get rid of the
timer altogether and go for NSObject's
performSelector:afterDelay:/cancelSelector: instead. Jeff's
enlightening (and frightening!) discussion about implicit retain
cycles makes me want to stay as far away from NSTimers as possible.
And no, this should not be a multihreading issue. The timer methods
are only called on the main thread, where the target (self) is my main
controller. Full backtrace below:
Process: MyApp [1333]
Path: /Users/user/Desktop/MyApp.app/Contents/MacOS/MyApp
Identifier: MyApp
Version: 1.0 (1.0)
Code Type: X86 (Native)
Parent Process: launchd [177]
Date/Time: 2010-09-21 11:28:57.566 -0600
OS Version: Mac OS X 10.6.4 (10F569)
Report Version: 6
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x91d6cc94 CFRelease + 196
1 com.apple.CoreFoundation 0x91de37c1
__CFRunLoopTimerDeallocate + 33
2 com.apple.CoreFoundation 0x91d6ce31 _CFRelease + 353
3 MyApp 0x0000878a 0x1000 + 30602
4 MyApp 0x00011da6 0x1000 + 69030
5 MyApp 0x000204d8 0x1000 + 128216
6 com.apple.AppKit 0x97792f1e -[NSApplication
sendAction:to:from:] + 112
7 com.apple.AppKit 0x97872699 -[NSControl
sendAction:to:] + 108
8 com.apple.AppKit 0x9786e146 -[NSCell
_sendActionFrom:] + 169
9 com.apple.AppKit 0x9786e094 -[NSSegmentedCell
_sendActionFrom:] + 70
10 com.apple.AppKit 0x9786d43d -[NSCell
trackMouse:inRect:ofView:untilMouseUp:] + 1808
11 com.apple.AppKit 0x9786c9f7 -[NSSegmentedCell
trackMouse:inRect:ofView:untilMouseUp:] + 1223
12 com.apple.AppKit 0x9786be93 -[NSControl mouseDown:] + 812
13 com.apple.AppKit 0x97869e9c -[NSWindow sendEvent:] + 5549
14 com.apple.AppKit 0x97782aff -[NSApplication
sendEvent:] + 6431
15 com.apple.AppKit 0x977165bb -[NSApplication run] + 917
16 com.apple.AppKit 0x9770e5ed NSApplicationMain + 574
17 MyApp 0x00002486 0x1000 + 5254
Thread 1: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x9875a942 kevent + 10
1 libSystem.B.dylib 0x9875b05c _dispatch_mgr_invoke + 215
2 libSystem.B.dylib 0x9875a519 _dispatch_queue_invoke + 163
3 libSystem.B.dylib 0x9875a2be
_dispatch_worker_thread2 + 240
4 libSystem.B.dylib 0x98759d41 _pthread_wqthread + 390
5 libSystem.B.dylib 0x98759b86 start_wqthread + 30
Thread 2:
0 libSystem.B.dylib 0x98762066 __semwait_signal + 10
1 libSystem.B.dylib 0x98761d22 _pthread_cond_wait + 1191
2 libSystem.B.dylib 0x987639b8
pthread_cond_wait$UNIX2003 + 73
3 com.apple.CoreVideo 0x992e286a
CVDisplayLink::runIOThread() + 1016
4 com.apple.CoreVideo 0x992e2456 startIOThread(void*) + 156
5 libSystem.B.dylib 0x9876181d _pthread_start + 345
6 libSystem.B.dylib 0x987616a2 thread_start + 34
Thread 3:
0 libSystem.B.dylib 0x987340fa mach_msg_trap + 10
1 libSystem.B.dylib 0x98734867 mach_msg + 68
2 com.apple.CoreFoundation 0x91d9cfaf __CFRunLoopRun + 2079
3 com.apple.CoreFoundation 0x91d9c094 CFRunLoopRunSpecific + 452
4 com.apple.CoreFoundation 0x91d9bec1 CFRunLoopRunInMode + 97
5 com.apple.Foundation 0x944b442c
+[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] +
329
6 com.apple.Foundation 0x9447b8d4 -[NSThread main] + 45
7 com.apple.Foundation 0x9447b884 __NSThread__main__ + 1499
8 libSystem.B.dylib 0x9876181d _pthread_start + 345
9 libSystem.B.dylib 0x987616a2 thread_start + 34
Thread 4:
0 libSystem.B.dylib 0x98753086 select$DARWIN_EXTSN + 10
1 com.apple.CoreFoundation 0x91ddc80d __CFSocketManager + 1085
2 libSystem.B.dylib 0x9876181d _pthread_start + 345
3 libSystem.B.dylib 0x987616a2 thread_start + 34
Thread 5:
0 libSystem.B.dylib 0x987599d2 __workq_kernreturn + 10
1 libSystem.B.dylib 0x98759f68 _pthread_wqthread + 941
2 libSystem.B.dylib 0x98759b86 start_wqthread + 30
Thread 6:
0 libSystem.B.dylib 0x987599d2 __workq_kernreturn + 10
1 libSystem.B.dylib 0x98759f68 _pthread_wqthread + 941
2 libSystem.B.dylib 0x98759b86 start_wqthread + 30
Thread 7:
0 libSystem.B.dylib 0x987599d2 __workq_kernreturn + 10
1 libSystem.B.dylib 0x98759f68 _pthread_wqthread + 941
2 libSystem.B.dylib 0x98759b86 start_wqthread + 30
Thread 8:
0 libSystem.B.dylib 0x9873415a
semaphore_timedwait_signal_trap + 10
1 libSystem.B.dylib 0x98761ca5 _pthread_cond_wait + 1066
2 libSystem.B.dylib 0x98790848
pthread_cond_timedwait_relative_np + 47
3 ...ple.CoreServices.CarbonCore 0x948a03b5
TSWaitOnConditionTimedRelative + 242
4 ...ple.CoreServices.CarbonCore 0x948a00f3 TSWaitOnSemaphoreCommon + 511
5 ...ickTimeComponents.component 0x953398bd
ReadSchedulerThreadEntryPoint + 4698
6 libSystem.B.dylib 0x9876181d _pthread_start + 345
7 libSystem.B.dylib 0x987616a2 thread_start + 34
Thread 9:
0 libSystem.B.dylib 0x9873415a
semaphore_timedwait_signal_trap + 10
1 libSystem.B.dylib 0x98761ca5 _pthread_cond_wait + 1066
2 libSystem.B.dylib 0x98790848
pthread_cond_timedwait_relative_np + 47
3 ...ple.CoreServices.CarbonCore 0x948a03b5
TSWaitOnConditionTimedRelative + 242
4 ...ple.CoreServices.CarbonCore 0x948a00f3 TSWaitOnSemaphoreCommon + 511
5 ...ple.CoreServices.CarbonCore 0x948fa900 AIOFileThread(void*) + 1127
6 libSystem.B.dylib 0x9876181d _pthread_start + 345
7 libSystem.B.dylib 0x987616a2 thread_start + 34
Thread 10:
0 com.apple.framework.IOKit 0x9244a7f7 iokit_user_client_trap + 7
1 com.apple.audio.CoreAudio 0x969f0b86
IOA_HWDevice::WriteOutputData(unsigned long, unsigned long, unsigned
long, unsigned long long) + 108
2 com.apple.audio.CoreAudio 0x969f09a2
IOA_SingleDevice::WriteOutputData(AudioTimeStamp const&, unsigned
long) + 422
3 com.apple.audio.CoreAudio 0x969f0285
IOA_Device::CallIOProcs(AudioTimeStamp const&, AudioTimeStamp const&,
AudioTimeStamp const&) + 573
4 com.apple.audio.CoreAudio 0x969effb6
HP_IOThread::PerformIO(AudioTimeStamp const&, double) + 620
5 com.apple.audio.CoreAudio 0x969ed39a
HP_IOThread::WorkLoop() + 2506
6 com.apple.audio.CoreAudio 0x969ec9cb
HP_IOThread::ThreadEntry(HP_IOThread*) + 17
7 com.apple.audio.CoreAudio 0x969ec8e2
CAPThread::Entry(CAPThread*) + 140
8 libSystem.B.dylib 0x9876181d _pthread_start + 345
9 libSystem.B.dylib 0x987616a2 thread_start + 34
Thread 11:
0 libSystem.B.dylib 0x98734136 semaphore_wait_trap + 10
1 ...ickTimeComponents.component 0x959fefaa QTThreadWaitSignal + 107
2 ...ickTimeComponents.component 0x953c3bfd audioprepThreadEntry + 68
3 ...ickTimeComponents.component 0x959fef24 start_thread + 54
4 libSystem.B.dylib 0x9876181d _pthread_start + 345
5 libSystem.B.dylib 0x987616a2 thread_start + 34
Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000000 ebx: 0x91d6cbdd ecx: 0x00000000 edx: 0xa0ac74c0
edi: 0x170a4ea0 esi: 0x00000000 ebp: 0xbffff198 esp: 0xbffff180
ss: 0x0000001f efl: 0x00000246 eip: 0x91d6cc94 cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
cr2: 0x537d6000
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden