0
我一直在行内存泄漏tempstr = [tempstr substringToIndex ... 我试过每种可能的分配tempStr组合, NSString * tempStr = @“”; NSString * tempStr = [[NSString alloc] init]; (在循环结束时发布) 我尝试调整NSString的范围。没有。它生产3泄漏 任何帮助,我可以尝试解决它将不胜感激。substringToString产生泄漏
while(x < [arr1 count]){
//NSLog(@"%@", [arr1 objectAtIndex:x]);
if([[arr1 objectAtIndex:x] rangeOfString:@".com"].location != NSNotFound)
{
//NSLog(@"%@", [arr1 objectAtIndex:x]);
tempStr = [[arr1 objectAtIndex:x] substringFromIndex:[[arr1 objectAtIndex:x] rangeOfString:@"http://"].location];
tempStr = [tempStr substringToIndex:tempStr.length - 1];
[arr1 replaceObjectAtIndex:x withObject:tempStr];
//NSLog(@"%@", [arr1 objectAtIndex:x]);
}
..... more code....
x++
}
我一直在假设我的autorelease池设置不正确。据我所知,它应该为我自动完成...我是不正确的? – Riley 2011-03-31 23:14:25
'NSString * tempStr = [[arr1 objectAtIndex:x] substringFromIndex:[[arr1 objectAtIndex:x] rangeOfString:@“http://”] .location]; tempStr = [tempStr substringToIndex:tempStr.length - 1]; [arr1 replaceObjectAtIndex:x withObject:tempStr]; '也泄漏 – Riley 2011-03-31 23:14:49