Objective c NSMutableArray在tableview CellForOwatineXpath委托中分配了内存,即使在释放后也会泄漏内存
在这段代码中,lCellColValues正在泄漏内存,即使我们自动释放它。知道为什么会出现泄漏吗???试试这个:Objective c NSMutableArray在tableview CellForOwatineXpath委托中分配了内存,即使在释放后也会泄漏内存,objective-c,ios,memory-leaks,nsmutablearray,Objective C,Ios,Memory Leaks,Nsmutablearray,在这段代码中,lCellColValues正在泄漏内存,即使我们自动释放它。知道为什么会出现泄漏吗???试试这个: NSMutableArray *lCellColValues =(NSMutableArray *)nil; lCellColValues = [[[NSMutableArray alloc] init] autorelease]; if(0 == lSecModulus) //trans info cell { if cObjTransListPtr.coun
NSMutableArray *lCellColValues =(NSMutableArray *)nil;
lCellColValues = [[[NSMutableArray alloc] init] autorelease];
if(0 == lSecModulus) //trans info cell
{
if cObjTransListPtr.count >0 && lObjTransData.m_cObjSDElemInfoPtr.count > 0 )
{
[lCellColValues addObject:lObjTransData.m_cObjTransNamePtr];
[lCellColValues addObject:[[NSNumber numberWithInteger:lObjTransData.m_cTransCounter] stringValue]];
}else {
if (nil != lObjSDElemInfo.m_cObjStartTimePtr)
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"HH:mm:ss";
[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]];
NSString *myDateAsString = [dateFormatter stringFromDate:lObjSDElemInfo.m_cObjEndTimePtr];
[lCellColValues addObject:myDateAsString];
SAFE_RELEASE(dateFormatter)
}else{
[lCellColValues addObject:@""];
}
[lCellColValues addObject:[[NSNumber numberWithDouble:lObjSDElemInfo.m_cElementTime] stringValue]];
}
}
if((CustSplitCell *)nil == lObjCellPtr){
if (m_cObjTransListPtr.count > 0) {
lObjCellPtr = [[[CustSplitCell alloc]initWithStyleAndTitles:UITableViewCellStyleDefault reuseIdentifier:lObjCellIdentifier titles:lCellColValues rowNumber:indexPath.row] autorelease];
}else {
[lCellColValues addObject:@""];
lObjCellPtr = [[[CustSplitCell alloc]initWithStyleAndTitles:UITableViewCellStyleDefault reuseIdentifier:lObjCellIdentifier titles:lCellColValues rowNumber:indexPath.row] autorelease];
}
}
它将自动分配和释放。NSMUTABLEARRY*lCellColValues=NSMUTABLEARRY*nil;它让我得了癌症如果我给NSMUTABLEARRY*lCellColValues=[NSMUTABLEARRY];addObject语句显示内存泄漏,我正在调用customclass并使用此数组初始化该类数据。现在它显示为潜在内存泄漏否,它没有修复内存泄漏。我需要一个解决方案,请我接受任何建议的解决方案。
NSMutableArray *lCellColValues =[NSMutableArray array];