NSMutableArray *a1 = [[NSMutableArray alloc] init];
NSMutableArray *a2 = [NSMutableArray array];
TempObj *obj = [[TempObj alloc] init]; //assume this line is repeated for each obj
[a1 addObject:obj];
[a1 addObject:obj2];
[a1 addObject:obj3];
[a1 addObject:obj4];
[obj release];
[obj2 release];
[obj3 release];
[obj4 release];
[a1 release];
Ok so a2 is an autorelease obj so i dont have to call release on it? Also how do you know when you get an autorelease object?
And for a1, i dont have to loop through the array and release each object first? What if i called [a1 removeAllObjects]; does that call [[a1 objectAtIndex:#] release];
Am i supposed to release those objects after ive added them to the array?