How to quit a lvgl app

Description

I created a lvgl destop and some app on it . If running one of the app and quit it, how to fully release the memory the app had used? Just delete the object? how about the style ?

Best Regards!
James

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

STM32H7

What LVGL version are you using?

V7.10

What do you want to achieve?

What have you tried so far?

I just delete the object.

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.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Use:
lv_obj_del(obj)

1 Like

Hi, Miguel,
Thank you!
I have deleted the object yet. But how to deal with the style list? There seems have some memory allcated for it.

Best Rgegards,
James

lv_style_reset should deallocate all memory associated with the style.

1 Like

Hi, embeddedt,
Thank you!
You means it must reset all the static style before the initial using? I do find out the memory leackage each time the app running and quitting. The most possibility would be the style ?

Best Regards,
James

Hi, embeddedt,
Further test shows that the memory leackage is still increasing by 30-50 byte each time the app page running and quitting, although I have reset all the style involved in the app page at the creating stage. The memory count is from lv_mem_monitor. What would be the reason?

Best Regards,
James

I am not entirely sure. I would suggest trying to isolate parts of your app and run them in isolation. Alternatively, if you can run it on a PC with LV_MEM_CUSTOM set to 1, I think Valgrind might have a feature for tracking memory leaks.

1 Like