Totally baffled here.
As the subject states, this is only something that started happening when I introduced music to my game.
I’m currently running the latest daily build, and about every 5-10 minutes the corona simulator will crash on the Mac and iOS. iOS and OSX versions behave exactly the same, they crash every 5-10 minutes.
This is a problem that I cannot replicate on Windows Corona Simulator or on Android. The game will run literally for hours without a single crash.
This is the error that terminal spits out in OSX:
Corona Simulator(12137,0xac8242c0) malloc: *** error for object 0x5a8464: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
/Applications/CoronaSDK/Corona Terminal: line 9: 12137 Abort trap: 6 “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*
logout
I use director.lua, and what I’m trying to do is have music play during the main menu and shop screens and such. Initially I used mp3’s for everything and thought that perhaps OSX and iOS don’t like MP3s as much as AAC, so I converted it to AAC. That didn’t do anything. Then I thought that maybe OSX and iOS don’t like audio.loadStream, so I changed the main background music file to audio.loadSound. But that didn’t do anything either.
In my main.lua I do this:
–backgroundMusic = audio.loadStream( “menumusic.mp3”)
–backgroundMusic = audio.loadStream( “menumusic.m4a”)
backgroundMusic = audio.loadSound( “menumusic.m4a”)
and since I’m using director, this is now a global variable that is accessible to all classes. When the game goes to start playing I do the following:
[code]
audio.fade({ channel=1, time=200, volume = 0 } )
local function pauseMusic()
audio.pause(backgroundMusic)
end
timer.performWithDelay(210,pauseMusic,1)
timer.performWithDelay ( 350, director:changeScene( “loadplaygame” ),1)[/code]
This is because I don’t want the music playing while the game is active, but I do want the music to continue from where it left off when the player returns to the menu or shop. So once the game is over, I fade the music back in and resume it. This is why I don’t free it up, and why I don’t use audio.fadeOut.
Unfortunately, I cannot for my life figure out what’s causing the crash. I have a feeling the garbage collector on OSX and iOS is trying to free up the memory, and it’s crashing the simulator/app, but I never ever evoke audio.stop, or play any sounds on the same channel. I’ve tried a million different things, but the behavior is always exactly the same, and it baffles me why it is only on OSX and iOS and doesn’t affect Android or Windows.
I listed it here because I believe it’s a Corona bug. (and will be embarrassed if it’s my own fault) [import]uid: 37122 topic_id: 26514 reply_id: 326514[/import]