Re: In-loop releasing of objects does not free memory?
Re: In-loop releasing of objects does not free memory?
- Subject: Re: In-loop releasing of objects does not free memory?
- From: Uli Kusterer <email@hidden>
- Date: Fri, 15 Feb 2008 00:22:14 +0100
On 14.02.2008, at 21:12, Nick Zitzmann wrote:
On Feb 14, 2008, at 12:49 PM, Uli Kusterer wrote:
Just for completeness' sake, this should really be:
NSAutoreleasePool * loopPool = [[NSAutoreleasePool alloc] init];
while( whatever ) // loop
{
// do stuff here.
[loopPool drain];
}
[loopPool release]; // don't forget this.
That'll cause a crash if GC isn't being used, since -drain is
documented as doing the same thing as -release in non-GC applications.
Oh? Are you sure? Wasn't aware of that.
But then the loopPool alloc/init statement should be inside the
loop, not outside, because otherwise you'll get the crash the second
time through the loop.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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