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];
}
}
在此代码中, lCellColValues 即使我们自动释放它也会泄漏内存。知道为什么会出现泄漏吗?
答案 0 :(得分:2)
试试这个:
NSMutableArray *lCellColValues =[NSMutableArray array];
它会自动分配和释放。