问题描述
- Mutablecopy mem泄露
- 这行出现了内存泄露?为什么?
Person.h-------NSMutableString *address;Person.m--------@synthesize address;-(id) init{ self = [super init]; address = [[NSMutableString alloc] init]; return self;}-(void) funcA(){ [address appendFormat:@""located|at|%@"" @""Singapore""]; address = [[address stringByReplacingOccurrencesOfString:@""|"" withString:@"" ""] mutableCopy];}-(void) dealloc{ [address release]; [super release]}
=address是一个NSMutableString,也是一个property。我只在dealloc方法中进行释放。
时间: 2024-11-02 17:32:10