NSMutableArray * lCellColValues = (NSMutableArray * ) nil;
lCellColValues = [[[NSMutableArray alloc] init] autorelease];
if (0 == lSecModulus) {
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];
}
}
NSMutableArray * lCellColValues = (NSMutableArray * ) nil; lCellColValues = [[[NSMutableArray alloc] init] autorelease];
Share
Maybe this could help you:
http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/MemoryMgmt/Articles/MemoryMgmt.html
I think You need to make sure that you use autorelease where appropriate, retain where appropriate, etc. If you just use alloc/init without autoreleasing, then you need to make sure you have a reference around after you are done with it that you can release it yourself. You take complete ownership of that object when you do things this way. This is all covered in the rules I linked to.
note that this answer is a copy of a comment in this question: Memory leak for object in array