-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Coalesce some allocations #3747
Coalesce some allocations #3747
Conversation
|
Done, re-did the tests with the Release version of the FW, and with all animations disabled. Now those readings look very plausible, I expected memory savings close to those readings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./fbt format
please
8d3d26c
to
071bbfd
Compare
Done. |
What's new
This PR coalesces memory allocations done by the firmware in several places by the use of Flexible Array Members, much like it's already done in a few other places in firmware, like Message Queues. The following structures have been modified to use FAM:
View
- view models now are a single allocation instead of two. Memory footprint - 4 bytes (mutex ptr) + arbitrary (user) view model data.SceneManager
- array ofAppScene
coalesced withSceneManager
. Footptint - 12 bytes? + array of scenes (4b each).BufferStream
- array ofBuffer
coalesced withBufferStream
. Footprint - 16 bytes + array of buffer streams (16b each).ProtocolDict
- array ofvoid* dict
coalesced withProtocolDict
. Footptiny - 8 bytes + 4 bytes per dictionary entry.DigitalSequence
andDigitalSignal
- data coalesced with the corresponding structs.I verified memory usage in the main menu by rebooting the Flipper, and pressing OK once. Readings from the Release version of FW are as follows:
Before:
After:
I did not add static assets for FAMs because GCC already throws a compilation error if they are not the last member of the struct.
Verification
Verify that the menus work, and that NFC and RFID apps still work as intended.
Checklist (For Reviewer)