iOS play crashing

I have a program that uses a lot of sound effects, I have noticed if I play these sound effects enough the iOS simulator justvexits no exceptions are raised, on device it just exits the app,
Anyone else noticed this?


I have been using sounds without any problems… but maybe not as hard as you do… Mine are all short, basically just normal Mac sounds that I have dropped into my iOS project… I play them from within a thread… At one point I play 5 sounds in 5 seconds…

Are you checking the Low Memory event on the app? I’m wondering if you’re overwhelming it and the app is telling you to release resources and you’re not, so it quits.

My impression is that compressed sound formats, such as MP3 lead to crashes more often than uncompressed. I used AIFF and WAV files without any problems.

Do you have a crash log?

In the app object add the low memory event with a break point. You may be running out of memory so the OS is killing your app since you don’t release resources.

I’ve just run into this and it still seems to be a bug. Going to try a few things to see if there’s some way to alleviate the issue, but it’s definitely some sort of memory leak related to sounds.

I think it may be from using the, instead of creating/saving an iOSSound and using .play on that. I’ll try it out and see if that makes any difference…

Posted this on the other thread here but it’s useful for both so I’m going to copy/paste it here:

I’ve run into this and found that if you have a sound file in your app and you repeatedly call .play directly from the sound file, that’s the cause of the memory leak. If you instead save an iOSSound object somewhere in memory and assign the sound file to it, and then call that sound’s .play, the crashing no longer occurs.

The problem here is you can’t play the same sound multiple times simultaneously. So you’ll have to check if it’s playing, and then decide what to do.

A secondary problem is that if you call iOSSound.Stop, it apparently takes a bit of processing power because it very briefly stalls the app. Wouldn’t matter much unless you’re making a game (which is usually why people use repeated sound effects like this…)