Extreme heap memory fragmentation

I noticed that the largest free block as returned by heap_caps_get_largest_free_block(MALLOC_CAP_8BIT)
goes from around 5MB slightly smaller than the total available heap size down to around 10k
after the first call to lv_timer_handler() which is defined lv-timer.c, part of lvgl component, not written by me.
Can this be anything to do with SLS?
Any hints appreciated!

Others

  • SquareLine Studio version: 1.4.2
  • Operating system: ESP-IDF vscode
  • Target hardware: ESP32-S3

It might be related to your LV_MEM_CUSTOM (whether the LVGL memory-allocation functions are used instead of those of the SDK) and LV_MEM_SIZE setting in lv_conf.h. The memory fragmentation can be displayed by enabling the memory-usage monitor in lv_conf.h (if LV_MEM_CUSTOM is set to 1). If it’s a simple project without large images, themes, etc. the memory-usage and fragmentation should be quite low, in the 100…200kbyte league.