Heap o' Trouble


#1

I’m sure most of you don’t have any feel for what heap is or why it’s reported in the status menu. Suffice to say that it’s the scratchpad that IoTaWatt (or any program for that matter) uses to keep track of things and prepare data for import/export via WiFi or SDcard. The underlying ESP8266 core and WiFi also make extensive use of the heap.

The firmware can allocate pieces of heap both implicitly and explicitly. When it does so explicitly, it must deallocate that piece when finished with it or it “leaks”, making it no longer available. These leaks had plagued recent ALPHA releases and were the reason behind the long delay in rolling it out to BETA and MINOR.

I think I can confidently say that all of the leaks have been fixed, except for a steady leak when passwords are set. I’m still working on that, but here is an influx/grafana plot of the heap from three test systems I have run for the past week. The large dips are when I plot something and larger buffers are needed to export the data. The smaller dips that last longer are when a status menu is updating at 1 second intervals.


The blue system - main - had passwords set until 8/22 when I removed them. All of the systems have run continuously for the past 9 days since release, so it looks very stable.

I plan to make this the MAJOR release at the end of next week. I’ll post a formal announcement.