I’ve noticed an on-going issue for quite some time where if I try to run a set of code more than once without exiting the editor by pressing “Done” and then opening it again, the app will crash.
Have you noticed this? It’s not a “Hard Crash”, as I would call it, because the app doesn’t close right away, but it stops responding and going back to Home Screen then back into the app ends up making the keyboard disappear and then again doing the same, eventually the app finally gets killed off and it loads again as if it was force closed. The interesting part is, force closing the app doesn’t stop it from this process. It has to go through the cycle of the keyboard disappearing and then the app eventually crashing before the app can be launched and used again.
The workaround I have found is what I mentioned above, exiting the editor and then opening it again. This seems to release some amount of memory or some resource anyway which makes the issue not happen.
I did some additional testing and it seems I’m able to run the script multiple times if I comment out any log lines. Could it be possible that the memory used by the console is not being released after each run? Maybe that memory / data should be released when the run button is pressed (if there is info in the console)?
I tried adding some of the log lines back in starting with a small log (2-3 characters) and I was able to run it multiple times still. I added in a longer log (around 100-300 characters) and after running it once it locked up the app again.
Could it be a memory issue? I’ve had instances of scripts crashing when I have some code that is either looping infinitely or using a lot of device memory. And anecdotally it seems like the app uses more memory while the editor/log is open, vs running the script from the main screen.
That’s my thoughts exactly. When the console / log is not open, it isn’t clearing the memory from the last run and when runs again it exceeds some limit by iOS and then crashes but not certain. The behavior is consistent enough at least to know that keeping the console / log closed will cause the problem if you have info being written there