After putting process.memory() at the end of the callback the errors seem to be gone, along with the inexplicable delays.
@allObjects: On top of this, I've replaced setInterval with setTimeouts as you suggested. This ensures that the intervals never overlap, allowing to use much shorter intervals.
Leaves the - somewhat academic - question open why explicitly calling the garbage collection via process.memory was necessary. GC takes about 15 ms, while the idle time between intervals is about 200 ms. I don't mind calling it, quite the contrary. Just thought that > 100 ms were enough for Espruino to decide to do it itself.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
After putting
process.memory()
at the end of the callback the errors seem to be gone, along with the inexplicable delays.@allObjects: On top of this, I've replaced setInterval with setTimeouts as you suggested. This ensures that the intervals never overlap, allowing to use much shorter intervals.
Leaves the - somewhat academic - question open why explicitly calling the garbage collection via process.memory was necessary. GC takes about 15 ms, while the idle time between intervals is about 200 ms. I don't mind calling it, quite the contrary. Just thought that > 100 ms were enough for Espruino to decide to do it itself.