0
메모리 관리 문제가 있습니다. 메모리 할당 때마다 페이지로드 및 메모리를 해제하지 않습니다 때 32kb 증가합니다. 그리고 총 메모리가 3 메가 바이트에 도달하면 얼마 후 그것은 1MB의 audiotoolbox malloc에만 충돌합니다. 여기 .H 파일에 나에게AvAudioPlayer 메모리 문제 audiotoolbox 32kb
도와주세요 내 코드입니다 : -
AVAudioPlayerDelegate
AVAudioPlayer *appSoundPlayer;
NSURL *soundFileURL;
@property (retain) AVAudioPlayer *appSoundPlayer;
@property (nonatomic, retain) NSURL *soundFileURL;
- .m file
@synthesize appSoundPlayer;
@synthesize soundFileURL;
-(void)viewdidload
{
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"Page_flip"
ofType:@"mp3"];
NSURL *newURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
self.soundFileURL = newURL;
[newURL release];
NSLog(@"**** We are now at cover page ****");
[super viewDidLoad];
}
#pragma mark -
#pragma mark read to me
-(void) readtome :(id) Sender
{
AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: soundFileURL error: nil];
self.appSoundPlayer = newPlayer;
[newPlayer release];
[appSoundPlayer setVolume: 1.0];
[appSoundPlayer setDelegate: self];
[appSoundPlayer play];
}
- (void) dealloc
{
[appSoundPlayer release];
self.appSoundPlayer = nil;
}