Running an app with two modes (reboot in between) with different LV_MEM_SIZE

Description

Running an app with two modes (reboot in between) with different LV_MEM_SIZE

What MCU/Processor/Board and compiler are you using?

ESP32-S3 WROOM 1N8, Custom designed board

What LVGL version are you using?

8.1.1

What do you want to achieve?

I have an app that have two modes (with reboot in between) that have very different memory usage: (checked with lv_mem_monitor)

Mode 1: Used: 24726 bytes
Mode 2: Used: 14048 bytes

I’m using the default LV_MEM_SIZE = 32U * 1024U. How do I reduce the LV_MEM_SIZE to 16U * 1024U when I reboot into Mode 2 ? So I can use the memory for other functions ?

What have you tried so far?

Using lv_mem_alloc(), lv_mem_realloc(),

But the memory usage stays the same

Code to reproduce


void lv_mem_alloc(size_t size);

void lv_mem_realloc(size_t size);

void lvgl_mem_monitor()
{
    lv_mem_monitor_t mem_mon;
    lv_mem_monitor(&mem_mon);
    log_i("Total: %d bytes\n", mem_mon.total_size);
    log_i("Used: %d bytes\n", mem_mon.total_size - mem_mon.free_size);
    log_i("Free: %d bytes\n", mem_mon.free_size);
    log_i("Fragmentation: %d %%\n", mem_mon.frag_pct);
}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Try complete disable LV_MEM_SIZE switch in conf to MEM_CUSTOM 1