Codea 2.7.5 (145)

@dave1707 looks like there’s a bad memory leak in the voxel stuff, trying to track it down. Your example was a big help

@Bri_G My Air has 16gb and my Pro has 128gb. The program usually runs ok until the 7th or 8th start. It’s probably a memory problem because that’s about the only time Codea crashes.

@dave1707 - have you tried clearing the garbage?

@Bri_G I put garbagecollect in there just for kicks, but the program still cancels after 7-8 restarts. Memory should be cleared when a program starts. I think it’s a Codea memory issue, not a memory issue with the program. The program above is just a test program to show the problem. Under normal conditions, sometimes Codea will crash when I’m in the editor after I’ve gone thru several cycles of making a program change and running a program.

fave1707 - just a thought. I am used to interpretive languages dropping out of the run mode when an error occurs. Recently I have noticed that Codea continues to run and post further errors. I have posted a comment on this previously. Could it be associated with that?

@Bri_G No. The code runs OK the first 6 or 7 times then crashes the 8 or so time. After that it will run 6 or 7 times then crash again. It’s probably a memory issue with Codea itself.

@dave1707 - hmmmm, so the code runs 6 or 7 times then crashes. Then, after restarting you run another 6 or 7 times before another crash. Couldn’t be that you have 7 instances running in parallel, the latest one visible, which gets junked when it crashes as Codea restarts clean? Do you still get a good fps?

@Bri_G I run the program then exit back to the editor. I run it again then exit back to the editor. I do that 6 or 7 times before Codea crashes. Codea wouldn’t be running my code when I’m in the editor so there won’t be 7 instances running. I don’t think Codea is cleaning up it’s memory upon restarts.

yes i suspect that as well, but not only for the voxel stuff!

What’s happening is that each time dave’s project runs it allocates memory for the voxels (including textures)

It was failing to release the texture loaded into memory, leading to around 25 MB of accumulated memory to sit in RAM

Each run keeps accumulating this wasted memory until the iPad decides Codea needs to just back off, and closes Codea

@Simeon - thanks for the update, doesn’t garbagecollect() pick that up? Also does iOS have it’s own memory manager monitoring apps, and is there a limit on the memory accessible to individual apps?

@Bri_G in this case it’s lower level than that. We’re allocating and failing to free memory at the C++ level. Lua doesn’t know about it so it can’t be affected by collectgarbage()

@dave1707 build 145 should fix the crash issue due to memory

@piinthesky hopefully this fixes your crash after >5 runs too

@Simeon My code above crashes at 12 restarts. I tried it twice and both times it crashed at 12.

@dave1707 damn, I have a feeling that one is not memory related now but I’ll try running over and over on an older iPad

@Simeon The Export Projects works great now. It doesn’t contain the Dropbox folder anymore. One thing I just found out. If you just tap the zip file, it opens Codea for restore.

@Simeon setInstructionLimit is missing. Is that the api you referred to.

@dave1707 hah yeah, that’s the one. It hadn’t been doing anything for a few years now,

@simeon with 145 consistently crashing on the 6th start (no voxels). Camera recording still gives grey screen on second try.

@piinthesky damn. Is this with a particular Craft project?