潜在泄漏? - 分析仪
问题描述:
分析状态泄漏问题,为什么?潜在泄漏? - 分析仪
+ (DebugOutput *) sharedDebug
{
@synchronized(self)
{
if (sharedDebugInstance == nil)
{
[[self alloc] init];
}
}
return sharedDebugInstance;
}
答
好sharedDebugInstance不分配,你可能想这样做:
sharedDebugInstance = [[self alloc] init];
+0
看看这个帖子还有:HTTP ://stackoverflow.com/questions/145154/what-does-your-objective-c-singleton-look-like – nico 2009-12-11 04:17:23
我一直想知道为什么这样的问题被标记为C ... – AnT 2009-12-11 07:09:21