0
儀器告訴我從下面的代碼中的以下行是泄漏:我無法弄清楚如何解決此泄漏問題。使用replaceObjectAtIndex在本聲明中發生什麼泄漏
[self.selectedElement.usrAdvancedBuyingPercents replaceObjectAtIndex:selectedRow withObject:[numberFormatter stringFromNumber:percentage]];
- (IBAction) simpleMarginSliderValueChanged:(UISlider *)sender {
NSDecimalNumber *percentage = (NSDecimalNumber *)[NSDecimalNumber numberWithFloat:[sender value]];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setPositiveFormat:@"#.##"];
[self.selectedElement.usrAdvancedBuyingPercents replaceObjectAtIndex:selectedRow withObject:[numberFormatter stringFromNumber:percentage]];
[numberFormatter release];
}
replaceObjectAtIndex是否釋放之前在該索引處的內容? – 2010-02-14 20:31:51
@Anon是的,它應該 – 2010-02-14 20:55:12
您發佈的代碼看起來對我來說是正確的。你能發表更多具體的信息嗎? (即,樂器說你在泄漏什麼?) – 2010-02-14 20:56:13