有內存泄漏在下面self.listOfCustDetail和self.listOfCustomer內存泄漏,跟蹤時間長
-(void) calCustList {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *plistPath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,@"customer.plist"];
self.listOfCustDetail = [[[NSMutableArray alloc] init] autorelease];
self.listOfCustomer = [[[NSMutableArray alloc] init] autorelease];
self.customers = [[[NSMutableDictionary alloc] initWithContentsOfFile:plistPath] autorelease];
[self.listOfCustomer removeAllObjects];
[self.listOfCustDetail removeAllObjects];
[self.listOfCustomer addObject:@"新紀錄"];
[self.listOfCustDetail addObject:@""];
for (id key in self.customers) {
NSString *s = [NSString stringWithFormat:@"%@,%@,%@,%@", [[self.customers objectForKey:key] objectAtIndex:0], [[self.customers objectForKey:key] objectAtIndex:1], [[self.customers objectForKey:key] objectAtIndex:2], [[self.customers objectForKey:key] objectAtIndex:3]];
[self.listOfCustomer addObject:key];
[self.listOfCustDetail addObject:s];
}
}
你怎麼知道有泄漏? – 2012-04-10 15:45:17