Codea crashing

I am currently working on a game, but every so often, when I am playing the game, Codea crashes. I was just wondering if this is my fault, having too much running in the game or if, when I export it to Xcode, the problem with resolve itself and stop crashing.

@Staples it’s hard to tell without code. What is happening when the crash happens? How many objects are you drawing?

@Briarfox I have a couple of screens set up as classes and drawn when necessary, but the app only crashes during the game screen. Then there are only 3 lines drawn, one sprite(the background), some text, and ellipses are constantly being drawn and removed. When the game crashes, there are usually about 8 ellipses drawn. I don’t find this to be very much at all. When measured it is running at around 60 fps, so there should be no reason for it crashing.

Are you running out of memory? Creating objects every frame and not deleting them?

@Coder I don’t think so. When an ellipse goes off the screen I use table.remove to get rid of it.

It’s difficult to see without sharing your code but use print statements to debug your code

Get the memory in use by calling


@Coder I’m not really sure what that calls, but I am getting back numbers ranging from around 250-290.

Hmm… Could you post your code to help us debug it please?

@Coder My code is pretty long so I’m not sure I should post it as it will just spam up the page. I can post it if you want, but It might be a bit confusing as there are a lot of images you won’t have.

I don’t mind if it helps you solve your problem. You could put all the code on the net, host on Dropbox maybe?

@Coder, here is a folder with all the code. For all of the code in one file to paste into Codea, go into the full code folder.

Thanks, I will look thru it as soon as I have acces to an iPad

@Coder, ok thanks! The actual app is not complete, but the game portion is playable. Pardon my work. I’m still learning Codea/lua so it’s not the best. Some concepts such as scrolling I sort of made up a way to get it working.

One reason for crashing may be this:

music("Dropbox:Theme for Harold var 2",Loop)

Rather than Loop use true as loop is an undeclared variable so it will pass nil rather than true or false

I think your problem is that you don’t destroy the basket and balls after each game so they are still there taking up memory and you create new ones and eventually there is no memory left so codea crashes