Is AudioServicesDisposeSystemSoundID required?
-
09-02-2021 - |
Question
I recently started working with the AudioToolbox framework and noticed that there is a method called AudioServicesDisposeSystemSoundID()
.
Just to know, is it a memory leak not to call the above method when calling AudioServicesCreateSystemSoundID()
to init my SystemSoundID
? I am calling it like:
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &sound);
That way filePath being a NSURL and sound SystemSoundID
.
Solution
Yes. Call it when you're done with sound
. Otherwise, you may leak any memory associated with sound
(which can be significant for A/V files.)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow