tags:

views:

700

answers:

2

I just started using Instruments and its Leak detection feature. I was monitoring my code and I noticed there is a leak when I call the method:

AudioServicesCreateSystemSoundID

I am basically using the SoundEffect.m file from the Metronome sample code. I am using a soundfile that was originally a .wav and I converted it using Itunes to a aif and renamed it a caf. It plays just fine and it wasn't until I ran Instruments that I realized there was a leak.

The odd thing is that, when I use a different sound file (tick.caf - from Mentronome sample project) - there is no leak. The same issue is described here with no real answer as to why:

http://discussions.apple.com/thread.jspa?messageID=8360344

Anyways, is there any reason why my sound file would cause a leak? Is Audio Toolkit particularly picky about the audio file it is trying to play??

+1  A: 

I don't see why it would cause a leak, but perhaps there is a bug in AudioServices when playing an aiff file named as caf. Try converting using afconvert to produce a real caf file from your mac:

afconvert -f caff -d ima4 input.mp3 output.caf
rpetrich
Yup that did it! Thanks!
WillF
A: 

Use AudioServicesDisposeSystemSoundID to dispose.

adityaeipl