I’m a embedded GUI developer, I try to apply the LVGL for new project as require from custom should use LVGL.
Before using the LVGL I worked with TouchGFX where I can create 100+ of screens and don’t worries the memory increase cause the memory usage is the maximum memory of one of all screen.
Back to current situation that project has multiple screens (20+) and there are limit of RAM I can not keep all screen, but If delete old screen when load new I face the problem with memory fragmentation.
Is there the way on LVGL configuration that when load to new screen it’s will override to old screen memory(RAM)?
LVGL doesn’t have a TouchGFX-style “max of all screens” static allocation as screens are dynamically loaded, but you can get very close:
Don’t build a new screen while the old is still alive. Either keep one permanent screen and call `lv_obj_clean()` before building a new one OR load an empty screen, delete the old one and build the new one.
Allocate long-lived things like styles at startup instead of loading them with the screen
You can use a custom allocator with LV_STDLIB_CUSTOM and use two TLSF pools, a global one for global/init-time allocations and then use another pool for the screens. This paired with 1 you can ensure the screen pool is always empty when doing step 1