Reputation: 1620
I have found a tonne of leaks in my code. All of them come about when I play a sound or a song.
Here is how I call a sound effect:
[[SimpleAudioEngine sharedEngine] playEffect:@"myeffect.wav"];
Here is how I play a song:
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"mysong.mp3"];
Am I somehow supposed to be releasing these after they are finished or something?
Upvotes: 4
Views: 1172
Reputation: 3669
To get the memory back, you need to call unloadEffect: on the SimpleAudioEngine.
Upvotes: 3
Reputation: 25011
You are using it right. Are you sure you have a memory leak? SimpleAudioEngine
will cache the audio file you play, for subsequent plays, so maybe that's why you see the memory increase and not decrease afterwards.
Upvotes: 2