Codea 1.5/1.5.1 crashing for anyone?

Have tried to locate the problem to no avail. My code works perfectly on xcode, iphone/ipad (as an ad-hoc app), but crashes randomly on codea runtime. I have patched 1.5.1 as well as remove usage of large sprites. I mostly use mesh() for speed.

Is anyone having the same problem as me?

I think it’s either a memory problem or a graphics problem because of its random nature. When I run it on xcode, there’s some warnings on the output page:
Mar 3 15:56:28 Peters-Mac-mini.local HWMar3B[2297] : CGContextSaveGState: invalid context 0x0

I dont know your problem, but myself i had many crashes when i use a lot of graphics, until i put a collectgarbage() call at the end of every function that generate big intermediate images (dereferenced). Since that i never had a single crash. This problem started for me with some codea 1.5 (x) beta version (i am among the beta testers) i had not experienced this before. But although i thought it was beta versions specific, i never removed the collectgarbage() call (well actually i made new programs without it, and they crashed as well, until i added the collectgarbage, but i though it was may ipad1 limits or my bad programming). Try it.

Wow Jmv38, you are a life-saver! Yes, it did indeed solve the problem. At the expense of some computing power (drop a few FPS). I would probably not include the line in the final release as it works fine w/o it. For me, it definitely was a codea 1.5 (x) issue. Would be nice to know what was the cause though.

.@zapaper if the crashes are related to image allocation, it can be a tricky issue. Codea automatically calls collectgarbage() when your iPad receives a low memory warning, cleaning up any images. But if you continue to allocate them fast enough, the iPad can still run out of memory.

So in the cases where, especially on older devices, you allocate a lot of images, collectgarbage can be helpful.

Good to know it helped you @zapaper. Concerning the fps problem: you do not have to put the collectgarbage() in every function. Just put it into a few well chosen function, to be sure it is called often enough, but not too often.