为什么会泄漏?这个Objective-C代码为什么会泄漏内存?
arrayOfPerformances
是合成的NSMutableArray
,(nonatomic, retain)
属性。
currentPerformanceObject
是Performance *
,(nonatomic, retain)
合成的属性。
Performance
是一个自定义类
if(self.arrayOfPerformances == nil)
{
self.arrayOfPerformances = [[NSMutableArray alloc]init];
}
[self.arrayOfPerformances addObject:currentPerformanceObject];
[currentPerformanceObject release];
currentPerformanceObject = nil;
尼克说什么;使用`[NSMutableArray数组]` – bbum 2010-11-30 03:36:00
哇,那个制定者真的搞砸了我的想法。我梳理了我的代码几个小时,试图找出泄漏的位置,并最终隔离了代码,并且无法弄清楚我的生活出了什么问题。太感谢了! – Mausimo 2010-11-30 03:41:30