In this assignment, you will analyze the binary image size and optimize the memory footprint of your application.
Assignment steps#
We will:
- Build the original project to spot any oversized or suspicious sections (e.g., .text, .data, .rodata) that may hide unoptimized code.
- Change configuration to reduce it.
- Rebuild the project to check the improvement.
Build the original project#
> ESP-IDF: Full Clean Project
> ESP-IDF: Build Your Project
You will get the summary table of Fig.1 for the binary image.

Fig.1 - Size calculation
Removing the logs#
- Remove the logging output in the menuconfig
if you don’t remember how to do that, check assignment 1.3 > ESP-IDF: Build Your Project

Fig.2 - Size calculation after removing logging
The binary size is 77kb less than before.
Certificate Bundle#
- Open menuconfig:
> ESP-IDF: SDK Configuration Editor (menuconfig)
- Uncheck
Certificate Bundle
→Enable trusted root certificate bundle
> ESP-IDF: Build Your Project

Fig.3 - Size calculation after removing certificate bundle
MQTT unused options#
- Open menuconfig:
> ESP-IDF: SDK Configuration Editor (menuconfig)
- Uncheck
ESP-MQTT Configurations
→Enable MQTT over SSL
- Uncheck
ESP-MQTT Configurations
→Enable MQTT over Websocket
> ESP-IDF: Build Your Project

Fig.4 - Size calculation after removing mqtt ssl and websocket support
We gained another 6.7kb.
Conclusion#
In this assignment, we saw how to check the size of our binary and how to use the menuconfig to removed unused options to improve the memory footprint of our application.
Next step: assignment 3.2