NSMutableArray memory management

后端 未结 5 1026
情歌与酒
情歌与酒 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:08

    i dont know either im right or wrong

    NSMutableArray *a1 = [[NSMutableArray alloc] init]; // will be autorelease
    NSMutableArray *a1 = [NSMutableArray alloc]; // will not autorelease
    

    after you [a1 removeAllObjects];

提交回复
热议问题