-
Notifications
You must be signed in to change notification settings - Fork 84
Reduce memory footprint #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…value has changed.
This reverts commit f754c9c.
|
Thanks for your contribution! Could you provide a comparison of the memory footprint (previous & now)? Thanks in advance! |
|
I measure free heap and max heap block and here it is the result:
It is a memory reduction of over 5000 bytes. |
|
Hold on, since I am experiencing memory leaks. It needs further research. |
|
I forgot to update... it is was a false alarm, my devices was restarting from time to time and I thought it was the new code, but it wasn't that 👍 Please, review it and let me know if the PR requires some refinement. |
This PR provides a heavy optimization over the strings used for text sensors, moving them from main SRAM memory to PROGMEM. In order to do it, it allocates static buffers for each text sensor up to the size of the max length of the strings. Although it requires static allocation, it prevents memory fragmentation and allow freeing a significant amount of memory.
In addition it includes an optimization on the management of the loop to show stats when the loop is taking too long.
And it also solves a recurrent "Too old data" issue by updating last_transmission when data is not available.