Error Out of Memory

Description

During operation, an Out of Memory error occurs (not immediately, periodically):
File: [Error] (60.076, +60076) lv_mem_alloc: couldn’t allocate memory (16 bytes) (in lv_mem.c line #138) # 536999156: µ„°
File: [Error] (60.089, +13) lv_mem_alloc: used: 30932 ( 48 %), frag: 1 %, biggest free: 34580 (in lv_mem.c line #141) # 536999156: µ„°
File: [Error] (60.102, +13) lv_img_decoder_built_in_open: Asserted at expression: dsc->user_data != NULL (Out of memory) (in lv_img_decoder.c line #385) # 536999228: µ„°

[Error] (51.999, +51997) lv_mem_alloc: couldn’t allocate memory (16 bytes) (in lv_mem.c line #138) # 536998900: µ„°
File: [Error] (52.012, +13) lv_mem_alloc: used: 30936 ( 48 %), frag: 1 %, biggest free: 34556 (in lv_mem.c line #141) # 536998900: µ„°
File: [Error] (52.024, +12) lv_img_decoder_built_in_open: Asserted at expression: dsc->user_data != NULL (Out of memory) (in lv_img_decoder.c line #385) # 536998972: µ„°

File: [Error] (23.206, +23204) lv_mem_alloc: couldn’t allocate memory (16 bytes) (in lv_mem.c line #138) # 536999044: µ„°
File: [Error] (23.219, +13) lv_mem_alloc: used: 31076 ( 44 %), frag: 1 %, biggest free: 40568 (in lv_mem.c line #141) # 536999044: µ„°
File: [Error] (23.231, +12) lv_img_decoder_built_in_open: Asserted at expression: dsc->user_data != NULL (Out of memory) (in lv_img_decoder.c line #385) # 536999116: µ„°

[Error] (2005.071, +2005069) lv_mem_alloc: couldn’t allocate memory (714 bytes) (in lv_mem.c line #138) # 536998764: µ„°
File: [Error] (2005.085, +14) lv_mem_alloc: used: 30216 ( 43 %), frag: 1 %, biggest free: 41388 (in lv_mem.c line #141) # 536998764: µ„°
File: [Error] (2005.098, +13) circ_calc_aa4: Asserted at expression: c->buf != NULL (Out of memory) (in lv_draw_sw_mask.c line #1271) # 536998836: µ„°

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

STM32F415RG

What LVGL version are you using?

v8.1.1

What do you want to achieve?

The application does not hang, there are no errors

What have you tried so far?

Changed the size of LV_MEM_SIZE, there is no effect. At the same time, the memory after creating objects is occupied by 40%, fragmentation is 1%
Now:
/Size of the memory available for lv_mem_alloc() in bytes (>= 2kB)/
#define LV_MEM_SIZE (70U * 1024U) /[bytes]/
Min_Heap_Size = 0x200 ;|/* required amount of heap /|
Min_Stack_Size = 0x400 ;|/
required amount of stack */|

I have this problem too, have you solved it? My LVGL version is also v8.1.1, but mcu is esp32.

yes, the problem was solved by using the lv_label_set_text_static function(v3_label_line 2, “bla bla bla”); instead of lv_label_set_text(v3_label_line 2, “bla bla bla”);
The thing is that when you call lv_label_set_text, the text is simply output, and when lv_label_set_text, memory is constantly reserved and then released using regular memory functions

1 Like