rust-embedded / book

Documentation on how to use the Rust Programming Language to develop firmware for bare metal (microcontroller) devices
https://docs.rust-embedded.org/book/
Apache License 2.0
1.12k stars 179 forks source link

document futures size explosion pitfall and mitigations #375

Open spookyvision opened 3 months ago

spookyvision commented 3 months ago

As explained e.g. here, futures can easily turn into unpleasant memory hog surprises. One possible easy way to investigate problematic code is to add a future-size-threshold = 100 (or whichever threshold seems reasonable) clippy lint.

Further information: withoutboats: Futures and Segmented Stacks

eldruin commented 2 months ago

We would welcome a PR explaining this. Please feel free to write it if you have the time.

spookyvision commented 1 month ago

I don't feel qualified enough to do a detailed writeup, so would rather see somebody else spearheading this. If nobody else takes it up, I can try and come up with 1-2 paragraphs…