修订
为什么NSData dataWithContentsOfFile
线表示仪器泄漏? 我正在使用ARC。部署目标是iOS的5.0在仪器的NSData dataWithContentsOfFile 100%泄漏
@autoreleasepool
{
AudioPlayerAV *context = [userInfo valueForKey:@"self"];
NSString *filepath = [userInfo valueForKey:@"filepath"];
[context.player stop];
//check if file is there fetch player from dict
AVAudioPlayer *_player = nil;
NSError *error = nil;
NSData *filedata = [NSData dataWithContentsOfFile:filepath];
_player = [[AVAudioPlayer alloc]initWithData:filedata error:&error];
context.player = _player;
NSLog(@"loadAndPlay error : %@",[error description]);
context.player.numberOfLoops = (context.loop)?-1:0;
context.player.volume = context.volume;
[context.player play];
}
100%分配或100%泄漏?这不意味着此时分配的增加是由该对象引起的100%吗? – Atif
和'dataWithContentsOfFile'返回一个'autoreleased'对象。它不应该是一个泄漏 – Atif
@Atif当然它不会但是这是造成泄漏,但活的字节数随着每次泄漏而增加。 – samfisher