多半是内存使用不当数组
1. 若是你要用很大长度的数组,那么能够换用更小的数据类型。好比,int值要占用两个字节,你能够用byte(只占用一个字节)代替;
2. esp8266有时会莫明重启,大部分状况是变量设置不当,虽然编译经过了,但变量在调用过程当中出现异常,形成函数运行时变量内存溢出,写复杂代码时,
最好是不要一次写了不少再编译调试。
3. 尽可能少用全局变量,全局变量在整个生命周期都会存在,很是耗内存,内存不足也是esp8266不稳定因素之一。长串的变量尽可能做长度控制,设定边界,若是你的项目很大,必定要规划好变量。
4. 尽可能不要在loop循环中定义变量,尽可能只放函数封装,貌似这里定义了变量不会像函数中的局变量用完就回收。函数
5.The ESP8266 requires a good power supply as it produces current spikes of up to 170 mA during transmit (typical average consumption is around 70 mA when WiFi is on). Check the power supply first, if your ESP runs unstable, has a bad throughput, or reboots from time to time. A large capacitor between Vdd and Gnd can help if you experience problems here. It has been reported that there are sometimes severe throughput problems with the small power supply/serial-to-usb boards for the ESP01. These boards use an XC6206 voltage regulator labeled "662K". Maybe you try an alternative power supply first, if you experience these kind of problems.oop