How to safe exit lvgl

Hi @kisvegabor, on my project lvgl has the following functions:

1. Gui window management, buffer size **800X600**
2. Draw the icon or text fill on the camera display, buffer size is **800X50**

Because there is not enough memory on my device, so when switch between function 1 and function 2, I need to exit lvgl each time, and then reinit lvgl with the new buff size.

If LV_ MEM_CUSTOM set 1, how safely release the resource of each lvgl during switching?

I look forward to your reply to the above questions, thank you ver much!

1 Like

I use lv_disp_remove when exit lvgl, the position B’s memory is about 5K bigger then position A.

show mem     //A
use lvgl
exit lvgl
show mem    //B

Sorry, the version of lvgl is V8.3.3.

1 Like

Hi @kisvegabor, do you know how to safety exit lvgl? I’m waiting for you answer, thanks.

Unfortunately we have no good option now to release all resources with MEM_CUSTOM 1. If the built-in memory manager is used we can easily re-init it and you will have a new empty memory.

So I think the simplest would be to use the internal memory manager (MEM_CUSTOM 0). Is it possible?

But do you really need to reinit the whole LVGL? Isn’t deleting all the screens enough?

I’m very glad get your reply.

Yes, I need to release lvgl resource, because the frame size of two mode is diffrent.

1. Gui window management, buffer size **800X600**
2. Draw the icon or text fill on the camera display, buffer size is **800X50**

I will try with LV_MEM_CUSTOM=0 used lv_disp_remove first, thank you very much!