Re: autorelease question
Re: autorelease question
- Subject: Re: autorelease question
- From: James Bucanek <email@hidden>
- Date: Fri, 5 May 2006 07:59:45 -0700
Jerrod Fowkes wrote on Friday, May 5, 2006:
>I have a thread that runs continuously. In that thread I need to keep checking
>a time interval. If it has become 15 mintues or an hour then do some sort of
>operation. Well, currently I am trying to use NSCalendarDate. My main question
>is :
>
>If I keep ' time = [NSCalendarDate calendarDate];' in a loop, will that flood
>the autorelease pool?
Depends. This this your own loop? Are you creating and releasing an NSAutoreleasePool in each interation?
If you're just spinning in loop that doesn't create its own autorelase pool, you're leaking objects. If this is code that runs periodically in a run loop then the run loop will create and release an autorelase pool each time so you don't have to worry about it.
>My other question is, Do you think this solution would be better handled with an NSTimer?
Oh yes. What your doing is polling, which is the worst kind of multitasking.
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden