question related to Iphone autorelease usage

Posted by user524331 on Stack Overflow See other posts from Stack Overflow or by user524331
Published on 2011-01-05T21:32:04Z Indexed on 2011/01/05 21:54 UTC
Read the original article Hit count: 163

Could someone help me please understand how allocation and memory management is done and handled in following scenario. i am giving a Psuedo code example and question thats troubling me is inline below:

interface first  
{ NSDecimalNumber *number1;  
}

implementation  
.....

-(void) dealloc {  
 [number1 release];  
 [super dealloc];  
}


=================================  
interface second  
{ NSDecimalNumber *number2;  
}  

implementation second  
.....  
- (First*) check  
{  
    First *firstObject = [[[First alloc] init] autorelease];  
    number1 = [[NSDecimalNumber alloc] initWithInteger:0];   
                    **// do i need to autorelease number1 as well?**  
    return firstObject;  
}  

© Stack Overflow or respective owner

Related posts about iphone

Related posts about memory-management