Hello all,
Please consider the following code:
//CallerClass.h
@interface CallerClass : UITableViewController {
NSMutableArray *dataArray;
}
@property(nonatomic,retain) NSMutableArray *dataArray;
-(void) setData;
//CallerClass.m
@implementation CallerClass
@synthesize dataArray;
-(id)initWithStyle:(UITableViewStyle)style {
if (self = [super initWithStyle:style]) {
[self setData];
}
return self;
}
-(void) setData
{
dataArray = [CalledClass getData];
[dataArray release];
}
//CalledClass.h
@interface CalledClass : NSObject {
}
+(NSMutableArray*) getData;
//CalledClass.m
@implementation CalledClass
+(NSMutableArray*) getData
{
NSMutableArray* tempArray = [[NSMutableArray alloc] init];
return tempArray;
}
I want to know what is the retain count for dataArray that is tempArray. Is it getting released. I dont want to use autorelease as I dont know till what time period I will need it. So I want to release it on my own. When I allocated tempArray, its retain count becomes 1. But when I assign it to instance variable dataArray whose property is retain, Is the retain count for that array becomes 2 or it stays 1. Like on releasing dataArray will it release memory.