Re: AutoreleasePools and Threads
Re: AutoreleasePools and Threads
- Subject: Re: AutoreleasePools and Threads
- From: David Rehring <email@hidden>
- Date: Wed, 03 Jul 2002 22:24:00 -0700
On 7/3/02 9:04 PM, Kevin Perry at email@hidden wrote:
>
Hi, in an application that I'm working on, there's a method detached in
>
another thread. Of course, in that method, an autorelease pool is
>
created as per necessity. However, in that method, there's a while()
>
loop that repeats indefinitely that creates a lot of autoreleased
>
objects that will never get released because the pool is released after
>
the while() loop. I've got a half-decent solution to create another
>
autorelease pool at the begin of the while loop and to release it at the
>
end of the loop. However, I don't believe this frequent allocing and
>
releasing of objects is as efficient as it could be. Is there a better
>
solution for this that I have failed to notice?
Once you get everything working right, you could try releasing the
autorelease pool and creating a new one say, every 50 or 100 loops.
I would probably base the number of loops that I would use on the memory
footprint that the objects you add to the autorelease pool use.
Later,
--
David Rehring Psychos do not explode when light hits
Senior Software Engineer them, no matter how crazy they are...
Atimi Software, Inc.
www.atimi.com And totally insane guy!
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.