任何人都可以告訴我爲什麼我在播放視頻時在樂器中顯示內存泄漏? movieURL和moviePlayer都保留,這些屬性稍後會在dealloc中釋放。在此先感謝您的幫助。MPMoviePlayerController中的內存泄漏
- (void)playMovie:(NSString *)movieString {
NSLog(@"playMovie movieString: %@",movieString);
self.movieURL = [Utilities localMovieURLForFileName:movieString];
if (self.movieURL) {
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:self.movieURL];
[[mp view] setFrame: [self.view bounds]]; // frame must match parent view
[self.containerViewController.view addSubview: [mp view]];
if (mp)
{
//save the movie player object
self.moviePlayer = mp;
[mp release];
[self setUpMoviePlayer];
// Apply the user specified settings to the movie player object
//[self setMoviePlayerUserSettings];
// Play the movie!
[self.moviePlayer play];
}
}
self.movieURL = nil;
}
謝謝。屬性是保留的。這是正確的,對嗎? – intomo 2011-03-06 01:07:38
只要你在你的dealloc方法中釋放它們,是的 – Macmade 2011-03-06 10:08:52