My device is running out of memory. How can I optimize?
If you encounter memory issues:
-
Reduce log verbosity in production builds:
CONFIG_LOG_DEFAULT_LEVEL_WARN=y -
Enable PSRAM if your chip supports it:
CONFIG_SPIRAM_SUPPORT=y -
Disable unused features: Turn off unnecessary RainMaker features:
/* Don't enable features you don't need */
/* esp_rmaker_schedule_enable();
* esp_rmaker_scenes_enable(); */ -
Monitor memory usage:
ESP_LOGI(TAG, "Free heap: %d", esp_get_free_heap_size());Or use the mem-dump serial console command when the console is enabled:
>> mem-dump
Description Internal SPIRAM
Current Free Memory 136572 0
Largest Free Block 114688 0
Min. Ever Free Size 110896 0