Skip Navigation

Ramblings from the team at zinc Roe

Metal Fish Eggs

Archive for June, 2009

AVAudioPlayer Memory Leak

While coding the sound for Arctic Shuffle 2, I ran into a non-obvious memory (to me, anyway) memory leak related to the AVAudioPlayer that took forever to track down. Here was my original code, which leaks if an error occurs in the initWithData:error: method: – (AVAudioPlayer *)audioPlayerWithContentsOfFile:(NSString *)path { NSData *data = [NSData dataWithContentsOfFile:path]; return [...]

Read the full post10 Comments