NSMutableArray *a1 = [[NSMutableArray alloc] init]; NSMutableArray *a2 = [NSMutableArray array]; TempObj *obj = [[TempObj alloc] init]; //assume this line is repeat
You released obj, obj2, obj3, obj4 just after adding them to the array(best way). Otherwise you'd have to loop and release each object (that's the stupid way : the one I've done till now).