What MCU/Processor/Board and compiler are you using?
STM32f407
What LVGL version are you using?
7.7
What do you want to achieve?
In my LVGL app, use “malloc(10)” will lead to the " No space in execution regions with …"error, But it’s OK for “lv_mem_alloc(10)” .
What have you tried so far?
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
Hi, I learned a lot from your words!
print p2 is abnormal because the “lv_mem_alloc” for p2 is failed. I found it can be OK if minify “LV_MEM_SIZE” in the lv_conf.h
/* Size of the memory used by lv_mem_alloc in bytes (>= 2kB)*/
define LV_MEM_SIZE (16U * 1024U) /the default is (32U 1024U)*/
So, Can the “LV_MEM_SIZE” be set to zero if app donot use lv_mem_alloc?
Thank you so much!
To disable the use of the LVGL managed heap you need to define LV_MEM_CUSTOM to be non zero in lv_conf.h and provide an include as well as definitions for LVGL internal memory management. lv_conf_template.h is a good reference when trying to understand LVGL configuration.
My experience is that it is better (for a few reasons) to use the LVGL heap for UI oriented purposes.