【发布时间】:2010-12-30 05:40:02
【问题描述】:
此代码片段内存泄漏,如何解决此内存泄漏?
-(NSDictionary *)sanitizedFinancialLine:(NSDictionary *)theFinancialLine
{
NSMutableDictionary *aFinancialLine = [NSMutableDictionary dictionaryWithDictionary:theFinancialLine];
for (id key in [aFinancialLine allKeys]) {
id something = [aFinancialLine objectForKey:key];
if ([something respondsToSelector:@selector(decimalValue)]) {
something = [NSDecimalNumber decimalNumberWithDecimal:[(NSNumber *)something decimalValue]]; // memory is leaking here
[aFinancialLine setObject:something forKey:key];
}
}
return [NSDictionary dictionaryWithDictionary:aFinancialLine];// and here
}
【问题讨论】:
-
最好粘贴代码文本而不是截图...
标签: iphone instruments