I'm working on adapting a clock program in NodeMCU.
The program is reporting heap usage to the serial console every second. The heap is varying between 12360 and 12472 as it runs successfully for 15 to 40 minutes. Then it crashes with:
E:M 2568
PANIC: unprotected error in call to Lua API (not enough memory)
At the point of failure, it is executing from a tmr.alarm function, as it has been doing for the whole run time:
tmr.alarm(1, 1000, 1, function() dofile("doloops.lua") end )
doloops.lua increments the time variables and updates the display. It does not perform any network activity. collectgarbage() is called at the end of every loop (1 per second)
Searching doesn't provide specifics on E:M 2568. What does the number following it mean? Can I use it to find the point where the memory issue occurs? What other NodeMCU functions could run asynchronously and use memory?
Is there another memory pool I should track in addition to node.heap()?