Large heap usage from nvs flash init
Posted: Thu Jan 27, 2022 4:26 am
ESP32-WROOM32UE on esp-idf 4.3.2
I'm seeing a massive chunk taken from heap when initializing the "storage" nvs partition, but I'm not sure why.
Partition table:
Init code
Commenting out the "storage" partition init results in a heap savings of almost 82kB, but I don't understand why. I have yet to write any code that gets/sets on that partition. Partition is purposefully at the end of the table so that we can expand for 16MB chips. Maybe this isn't necessary. Should I just combine that with the primary nvs partition? 82k usage results in insufficient memory for our functionality beyond wifi, bluetooth, azure, etc.
I'm seeing a massive chunk taken from heap when initializing the "storage" nvs partition, but I'm not sure why.
Partition table:
Code: Select all
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, , 0x6000
phy_init, data, phy, , 0x1000
otadata, data, ota, , 0x2000
ota0, app, ota_0, , 2M
ota1, app, ota_1, , 2M
storage, data, nvs, , 0x3DF000
Code: Select all
// Initialize NVS
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
err = nvs_flash_init();
}
ESP_ERROR_CHECK( err );
//storage nvs partition
err = nvs_flash_init_partition("storage");
if (err == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase_partition("storage"));
err = nvs_flash_init_partition("storage");
}
ESP_ERROR_CHECK( err );