-4
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也会泄漏内存。知道为什么它显示泄漏吗?

4

1 回答 1

2

尝试这个:

NSMutableArray *lCellColValues =[NSMutableArray array];

它会自动分配和释放。

于 2012-10-30T10:33:25.393 回答