我在開發一個應用程序,其中我發現內存泄漏以下方法如何消除泄漏?我如何解決內存泄漏問題?
- (id)initWithString:(NSString *)str attributes:(NSDictionary *)attributes
{
if ((self = [super init]))
{
_buffer = [str mutableCopy];
_attributes = [NSMutableArray arrayWithObjects:[ZAttributeRun attributeRunWithIndex:0 attributes:attributes], nil];
}
return self;
}
我創始泄漏靠近這條線 「_buffer = [STR mutableCopy];」
在分配堆棧跟蹤我發現同時內存分配增加爲一個CFString。
謝謝。
請特別注意格式化您的代碼。你的一點努力可以幫助我們幫助你。 – 2010-09-17 15:10:47