Re: AutoreleasePools
Re: AutoreleasePools
- Subject: Re: AutoreleasePools
- From: Ondra Cada <email@hidden>
- Date: Thu, 4 Jul 2002 14:56:00 +0200
I've taken liberty to remove the "threads" part, since this has nothing to
do with them actually.
On Thursday, July 4, 2002, at 06:04 , Kevin Perry wrote:
...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?
The generic pattern is something like this:
id pool=[NSAutoreleasePool new];
while (....) {
if (something, like N-th loop, or M seconds from last creation, or
whatever) {
[pool release];
pool=[NSAutoreleasePool new];
}
...
}
[pool release];
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.