SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.52k stars 491 forks source link

newlib: rebuild with the global stdio streams enabled. #583

Closed ourairquality closed 6 years ago

ourairquality commented 6 years ago

This change means that there is only one set of global stdin, stdout, and stderr FILE streams shared by all the threads. This reduces memory usage and avoids having to close these streams before threads exit. These streams still have a lock to synchronise access.

This was explored to address https://github.com/SuperHouse/esp-open-rtos/issues/564 but it seems to save a useful bit of memory too. Guess the stdio file stream memory usage adds up with a good number of threads.

This required adding support to newlib for this global stdio streams option when using the reent small option. Shall submit the change upstream for feedback there.

Testing and feedback welcomed.

Zaltora commented 6 years ago

I got no problem using this PR in my project. it allow to me 3.5k more heap.

ourairquality commented 6 years ago

The newlib patch was accepted upstream. There were only some minor documentation improvements. This patch seems a good 'next step', ahead of the icache/iram usage patch.