Re: Immediate memory release
Re: Immediate memory release
- Subject: Re: Immediate memory release
- From: email@hidden
- Date: Wed, 30 Apr 2008 15:35:43 +0200
Or you could go with:
-(IBAction) Generate:(id) sender
{
for (i = 0; i < count; i++)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSImage* tempSource = [[[NSImage alloc]
initWithContentsOfFile:sPath[i]] autorelease];
// autorelease tempSource to ensure that we get cleaned up if
anything in 'some code' throws an exception.
// pool will automagically be released later if an exception does
happen and [pool release] get bypassed.
// some code
[pool release];
}
}
Matt
On 30 Apr 2008, at 14:18, Graham Cox wrote:
-(IBAction) Generate:(id) sender
{
for (i = 0; i < count; i++)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSImage* tempSource = [[NSImage alloc]
initWithContentsOfFile:sPath[i]];
// some code
[tempSource release];
[pool release];
}
}
_______________________________________________
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