How can I confirm LV_MEM_SIZE?

Description

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

ESP32-S3

What LVGL version are you using?

v8.3.10

What do you want to achieve?

When I scrolled through the roller, I received an error Log ( assert failed: block_locate_free tlsf.c:566 (block_size(block) >= size) ). And I learned from various sources that this is caused by the LV_MEM_SIZE being too small. So I tried increasing CONFIG_LV_MEM_BUF_MAX_NUM and the problem was resolved.
But I want to know the following three points:

  1. How large LV_MEM_SIZE needs to be?
  2. How large CONFIG_LV_MEM_BUF_MAX_NUM needs to be after selecting CONFIG_LV_MEM_CUSTOM?
  3. How to calculate these two parameters?

What have you tried so far?

Increase CONFIG_LV_MEM_BUF_MAX_NUM to 64

1 Like

Hi All,

I also have the same doubts, I am currently facing similar problems while running a LVGL app at my end. Upon enabling the logs in my application it seems that the LVGL is unable to allocate memory. (PFA Logs).

I have created LVGL UI for resolution 1024x600, in 32-bit format after selecting LVGL v9.1. Software used is SquareLine Studio.

My application uses LVGL v9.2, and in the lv_conf.h, I am using the CLIB for memory allocation.
#define LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB

Is there a way to determine the size of the dynamic memory at compile time which the LVGL will use at run-time. This may help in deciding memory configurations of the system beforehand.

Thanks and Regards
Ayush

I’ve been using the LVGL heap, and periodically printing its memory usage from lv_mem_monitor() to make sure we have enough free UI heap.

Thanks a lot @Bryght-Richard, I will try using this.

lv_mem_monitor() reports on the heap when the heap is managed by LVGL, ie when you use LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN, and only on the heap managed by LVGL, not the overall heap on the system. If you are using LV_STDLIB_CLIB, you’ll need to use whatever tools your system provides for getting heap usage, or write your own - LVGL won’t know.

A compiler cannot know dynamic memory usage at compile time, as it is defined by what happens at runtime! May be rephrase your question?