Re: Strange retainCount from NSTimer
Re: Strange retainCount from NSTimer
- Subject: Re: Strange retainCount from NSTimer
- From: Chris Suter <email@hidden>
- Date: Fri, 14 Mar 2008 12:42:47 +1100
On 14/03/2008, at 12:37 PM, Brian Greenstone wrote:
But that shouldn't be, right? Shouldn't the retainCount of theTimer
be 1 after scheduledTimerWithTimeInterval? Then shouldn't it be
bumped up to 2 after adding the timer to the Run Loop? It appears
that the retain count is starting at 2 which is wrong, and then not
being incremented by addtimer which is wrong. In the end the count
is still 2, so it is valid, but I'm confused why the counts are
doing this.
scheduledTimerWithTimeInterval adds the timer to the run loop. I'm
guessing the retain count is two because of the run loop retaining it
and an autorelease. It doesn't change after adding it to the run loop
because it's already in the run loop. I believe there are other class
methods you can use if you want to add it to the run loop yourself.
- Chris
_______________________________________________
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