esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
16.09k stars 13.32k forks source link

Improve available heap #3740

Open devyte opened 7 years ago

devyte commented 7 years ago

Hardware

Hardware: all Core Version: git / 2.4-rc2

Problem Description

Summary

This issue is meant to track a RAM optimization effort. The goal is to increase available RAM as much as possible.

Details

The following are initial ideas to investigate.

devyte commented 6 years ago

@steminabox about floating point support, you misunderstood me: it was not put into IRAM, it was just added to the code base. I meant it as an example as to why the core is always increasing in size: features are being added. If you search the code for ICACHE_RAM_ATTR, you'll find all the functions in the core that are specified to be in IRAM, and if you think about each case you'll understand why they have to be there. Those are not all, though, there are parts of the SDK that have to be in IRAM as well, among others. But we're getting off topic. This thread is meant to cover increasing free heap, which is the single biggest obstacle right now for secure sockets. The IRAM issue is a different one, and there is a discussion already ongoing elsewhere. So if you have an idea about improving free heap, bring it up here.

steminabox commented 6 years ago

yep, I'll continue about IRAm in the other thread, though having infinite heap and no ability to load your program isn't that useful :-)

So my last comment, actually on topic :-) - with the heap the best way to keep spare space is to never use memory unless you have to, defer it until the last moment, and keep for as short as time as possible.. There is normally a trade off with doing this and cpu time (and mem fragmentation)- but the 8266 seems to have lots of cpu for the amount of memory it has.. I don't know if fragmentaion would be a problem, then again, most 8266s could reboot every now and again..

devyte commented 6 years ago

A lot has been done for this, but there is still more to do...