Re: Cache Class review (low priority)
Re: Cache Class review (low priority)
- Subject: Re: Cache Class review (low priority)
- From: Gregory Weston <email@hidden>
- Date: Fri, 2 May 2008 07:37:27 -0400
Jens Alfke wrote:
On 1 May '08, at 4:49 PM, Western Botanicals wrote:
[NSTimer scheduledTimerWithTimeInterval: defaultSleepTime target:
self selector: @selector(run:) userInfo: nil repeats: YES];
That timer is autoreleased, so you have to retain it or it'll go away
after your init method returns.
Not unless the docs are lying (and based on heavy timer usage in some
of my apps, I'm going to claim they're not). From the NSTimer overview:
"Note in particular that run loops retain their timers, so you can
release a timer after you have added it to a run loop."
That said, proper conformance to the memory contract would be that
you *do* retain it if you do this...
Typically you'd then assign it to an ivar; then when you need to
stop the
timer, you call -invalidate and -release on it.
But as long as the OP has no intention of manually invalidating the
timer, what's already there is sufficient.
_______________________________________________
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