Hello everyone.
I'm having trouble pin pointing the source of an error I'm encountering.
My game runs OK for around 5 to 7 minutes and then it freezes and a couple of seconds later the Playdate shows the e0 error screen.
My first thought was a memory leak, but looking at the device info while running, the memory is steady and far from the maximum when the error happens. In the following screenshot you can see that the game was using around 60% of the memory before the crash. And after the crash the graph just goes crazy filling up the whole screen
EDIT: I forgot to add, there are no errors in the console.
So my question is, what are other possible causes of the e0 error apart from memory leaks? I though about a stack overflow, but I'm not using recursion.
That crashlog entry indicates it's crashing within the code to update the Lock button LED, since it should flash white when the device crashes. What's probably happening here (at least, according to Dave on Discord) is that it crashed for some other reason but the LED code is crashing instead, so the crashlog isn't going to be of much help to determine the root cause.
My best guess is that you've created an infinite loop in your code:
The device has a watchdog timer so that if your game's update callback runs for more than 10 seconds without returning or yielding, the device will crash with an e0.
The simulator becomes unresponsive because it has no such watchdog.
It was due to a projectile that kept going infinitely out of the screen and its Y coord reached a value too high for the Playdate to handle.
I always try to avoid these kind of issues and I have code to handle the elements where they are out of the screen, but in this edge case, the projectile "avoided" my checks and kept going. It was very tricky to catch because one of the conditions for the error to happen was that the projectile was already out of the screen when spawned.
Well. I hope this post helps someone on the future. The error e0 is not only because of infinite loops, but also caused by value over/underrun.