0
這是我的代碼片段:我該如何解決這個內存泄漏問題?
- (id) initWithFrame:(CGRect)frame andConfig:(PGParams*) params
{
for (int i=0; i<[conf.map count]; i++)
[conf.map replaceObjectAtIndex:i withObject:
[[NSString alloc] initWithFormat:@"%@&sito=%@",
[conf.map objectAtIndex:i], [params sito]]];
for (int i=0; i<[conf.orto count]; i++)
[conf.orto replaceObjectAtIndex:i withObject:
[[NSString alloc] initWithFormat:@"%@&sito=%@",
[conf.orto objectAtIndex:i], [params sito]]];
for (int i=0; i<[conf.mix count]; i++)
[conf.mix replaceObjectAtIndex:i withObject:
[[NSString alloc] initWithFormat:@"%@&sito=%@",
[conf.mix objectAtIndex:i], [params sito]]];
}
編譯此代碼與RUN_CLANG_STATIC_ANALYZER
選項(屬性 - >編譯選項 - >運行靜態分析儀),它給我上[[NSString alloc] ...
泄漏。
RUN_CLANG_STATIC_ANALYZER
激活此設置將導致Xcode的運行符合條件的源文件鏘靜態分析工具。該工具目前支持C和Objective-C文件。 [RUN_CLANG_STATIC_ANALYZER]
我該如何解決呢?
由於事先
allberto
對!謝謝,現在已經修好了! – elp 2010-12-11 19:07:10