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];
}
}
-3
A
回答
1
我認爲你需要確保你使用自動釋放在適當情況下,保留在適當情況下,等等。如果你只是使用alloc/init而不進行autoreleasing,那麼在完成後你需要確保你有一個參考,你可以自己釋放它。當你這樣做時,你完全擁有該物品。這些都包含在我鏈接的規則中。
注意,這個答案是一條評論在這個問題上的副本:Memory leak for object in array
+1
謝謝yu沒有給developer.apple.com作爲參考。我的意思是我們知道我們可以訪問網站中的內存管理細節 – user1785195
相關問題
- 1. 的NSMutableArray在tableview中cellFoRowAtIndexPath代表分配的內存,它正在泄漏內存甚至釋放
- 2. 內存泄漏與陣列
- 3. 內存泄漏與陣列
- 4. 代表和內存泄漏在iPhone?
- 5. 內存泄漏在C /內存分配++
- 6. 陣列中物體的內存泄漏
- 7. Objective-C /陣列中的內存泄漏
- 8. 內存泄漏:在線分配的對象的潛在泄漏
- 9. 內存泄漏在NSObject的分配
- 10. 在uiwebview分配內存泄漏
- 11. iAds正在泄漏內存
- 12. WebClient.DownloadString()的內存泄漏/分配問題?
- 13. 的Java分配內存泄漏
- 14. 內存泄漏
- 15. iOS:內存泄漏代碼
- 16. iphone UIImage陣列內存泄漏
- 17. 內存泄漏排序陣列
- 18. 內存泄漏與陣列 - 目標c
- 19. 內存泄漏與陣列或CGImageRef
- 20. YAJL內存泄漏問題陣列
- 21. pushViewController內存泄漏
- 22. 鏈接列表中的內存泄漏
- 23. 鏈接列表中的內存泄漏
- 24. 是否正在分配多餘的內存,是否存在內存泄漏?
- 25. 自定義分配器泄漏內存
- 26. iphone內存分配和泄漏
- 27. 動態分配泄漏內存?
- 28. 內存泄漏的代碼
- 29. 代碼中潛在的內存泄漏
- 30. 內存泄漏:
你能讀懂你已經粘貼在這裏的代碼? –
我無法編輯代碼。請嘗試瞭解@ Praveen S – user1785195
如果有人給出答案,他們將得到很好的讚賞。 – user1785195