FROM : matt.gough
DATE : Wed Apr 30 15:35:43 2008
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];
> }
> }
DATE : Wed Apr 30 15:35:43 2008
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];
> }
> }
| Related mails | Author | Date |
|---|---|---|
| Yannick De Koninck | Apr 29, 13:30 | |
| Graham Cox | Apr 29, 13:37 | |
| João Pavão | Apr 29, 13:44 | |
| Paul Bailey | Apr 29, 13:44 | |
| Joseph Kelly | Apr 29, 16:50 | |
| Bob Smith | Apr 29, 22:33 | |
| Yannick De Koninck | Apr 30, 14:09 | |
| Graham Cox | Apr 30, 14:18 | |
| Roland King | Apr 30, 15:08 | |
| Graham Cox | Apr 30, 15:17 | |
| matt.gough | Apr 30, 15:35 | |
| Graham Cox | May 1, 02:53 | |
| Jens Alfke | May 1, 04:27 | |
| Graham Cox | May 1, 04:45 | |
| Chris Suter | May 1, 04:59 | |
| Melissa J. Turner | May 1, 05:35 | |
| j o a r | May 1, 07:00 | |
| Paul Bailey | May 1, 11:05 | |
| Clark Cox | May 1, 16:16 | |
| Ken Thomases | May 1, 18:31 |






Cocoa mail archive

