- Sat Jun 06, 2015 12:46 pm
#19665
Cal,
My experience is that PANICs tend to occur for one of two main categories of reason
- You've called an invalid target: either simply a mistype in the method name or your "table" / object ref is no longer in scope or
- You've ran out of RAM.
In both of these then there's little that you can do other than die. Certainly as far as I am concerned, I can rapidly identify which line of code crapped out, and if its a typo then fix it. Identifying
why a resource leak is occurring is an entirely different matter, because I avoid the usual bear traps and what those that are left are difficult to diagnose. A good example that I see is where users do a bunch of
sk:send() calls not realising that queuing these eats RAM.
We constantly have a trade-off and a dilemma with the ESP8266 -- There is always a temptation to add extra functionality / validation etc. but we then bitch because there's not enough RAM left to run our application, or we upgrade the firmware to a new version to clear a few bugs, only to discover our application no longer fits. I am not sure what the answer is here, though custom builds where you can omit modules that you don't use does help.
Please see my
Developer FAQ for Q&A on nodeMCU Lua before asking a question here that's already been answered. This and the other official documentation should be your first reference for developing Lua Apps