Memory block limitation

I have a problem where my program crashes, because the block size is wrong. I’m using the lvgl own memory management and lv_tlsf_realloc is crashing because block_size is returning so big value that it tries to access memory which isn’t there. I have used lv_mem_monitor just before creating the next widget and it will return:

total_size 49152
free_cnt: 1
free_size 37352
free_biggest_size: 37352
used_cnt: 330
max_used: 0
used_pct: 25
frag_pct:0

The next widget is just a button, so there shouldn’t be a problem to fit that to the available memory. Is there a limit for memory blocks and/or widgets? What does free_cnt mean?

There shouldn’t be such limitations. Please enable

  • LV_USE_ASSERT_STYLE
  • LV_USE_ASSERT_OBJ
  • LV_USE_ASSERT_MEM_INTEGRITY

And call LV_ASSERT_MEM_INTEGRITY(); before the crash. It should assert if the memory is messed up.

Thanks for the quick help. I was assigning text to the button and not to the label for the button :disappointed:

Ah, glad to find the problem! :slight_smile: