我正在使用MPMoviePlayerController一个接一个地播放我的电影。我在播放完成后释放控制器,但我仍然在对象分配工具中看到一些剩余内存...对此行为的任何想法。我期待在电影结束并且控制器被释放后,对象分配是否应该回到原始位置?
这是我实例化控制器的方式..
//Initialize a MPMoviePlayerController object with the movie.
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
//Set the scaling mode to fill the screen with the movie.
moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
//Add an observer so we can be told when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[moviePlayer play];
播放结束后......我发布了这样的控制器....它正在完美释放......但仍然有一些剩余的记忆......
//仅限3.0或以上
moviePlayer.initialPlaybackTime = -1.0;
[moviePlayer stop];
[moviePlayer release];
moviePlayer = nil;
不要担心NSString泄漏,它已被修复。之后我发现MPMoviePlayerController留下了一些剩余的内存分配