NSMutableArray memory management

后端 未结 5 1037
情歌与酒
情歌与酒 2020-12-09 08:48
NSMutableArray *a1 = [[NSMutableArray alloc] init];
NSMutableArray *a2 = [NSMutableArray array];

TempObj *obj = [[TempObj alloc] init]; //assume this line is repeat         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 09:27

    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).

提交回复
热议问题