NSString的内存区汇总

NSString *testStr1 = @"a";//常量区

NSString *testStr2 = [NSString stringWithString:@"a"];//常量区

NSString *testStr3 = [NSString stringWithFormat:@"b"];//堆区

NSString *testStr4 = [[NSString alloc] initWithString:@"c"];//常量区

NSString *testStr5 = [[NSString alloc] initWithFormat:@"d"];//堆区

NSString *testStr6 = [[NSString alloc] init];//没有意义

posted @ 2015-12-25 00:11  iospp  阅读(274)  评论(0编辑  收藏  举报