Demystifying Memory: A Practical Tutorial on Managing & Optimizing Memory in Zephyr
summary
Build targets are an nRF5340 plus nRF7002 with external flash and XIP, running the Azure IoT Hub sample and LVGL assets; out of the box the image leaves ~61 KB flash and ~69 KB RAM for application logic. Analysis uses nm, addr2line, the punkcover visualizer, thread analyzer and the kernel-heap shell to find big spenders: embedTLS heap (~81 KB allocated, ~50 KB actually used), Wi‑Fi pools and stacks. Tweaks (heap/slab sizes, disable IPv6, move firmware to external flash) roughly double usable RAM and reclaim ~8 KB from the TFM partition.
AI-written summary · about
chapters (14)
- 0:00Memory management in Zephyr
- 6:04Flash and RAM basics
- 8:14Heap and slab techniques
- 12:32Memory analysis tools
- 16:52Heap runtime analysis
- 21:13Network stack memory
- 24:53Memory optimization strategy
- 28:45Demo: puncover tool
- 33:47Analyzing memory with puncover
- 36:59RAM runtime analysis
- 41:13Flash partition table
- 43:28Optimization results
- 45:58Key learnings
- 48:28Closing remarks
related talks
51mDemystifying Memory: A Practical Tutorial on Managing & Optimizing Memory in Zephyr
41mZephyr RTOS: Under 1KB of RAM
40mInspecting and Optimizing Memory Usage in Linux
34mZephyr Footprint – Where Are We and Where Are We Going
29mTowards an Alternative Memory Architecture
49mEmbedded Linux Size Reduction Techniques
43mFrom Code To Current: Reducing Energy Consumption in Zephyr
38mDeferred Memblocks Init for Boot Time Reduction
