Description
switching screen will cause memory leaks,Memory usage increases every time you switch screens
What MCU/Processor/Board and compiler are you using?
stm32f746g-disco,lvgl v8.3.3
What do you want to achieve?
Switching screen will not cause memory leaks
What have you tried so far?
Add lv_obj_clean(lv_scr_act()); in event_handler,but didn’t solve the problem
Code to reproduce
static void screen_1_btn_6_event_handler(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
switch (code)
{
case LV_EVENT_CLICKED:
{
lv_obj_clean(lv_scr_act());//This is what I added
if (!lv_obj_is_valid(guider_ui.screen_3))
setup_scr_screen_3(&guider_ui);
lv_disp_t * d = lv_obj_get_disp(lv_scr_act());
// if (d->prev_scr == NULL && d->scr_to_load == NULL)//If this paragraph is not commented, the screen will be blank after triggering the button
lv_scr_load_anim(guider_ui.screen_3, LV_SCR_LOAD_ANIM_NONE, 1000, 1000, true);
}
break;
default:
break;
}
}
static lv_style_t style_screen_1_main_main_default;
if (style_screen_1_main_main_default.prop_cnt > 1)
lv_style_reset(&style_screen_1_main_main_default);
else
lv_style_init(&style_screen_1_main_main_default);
used an if() statement to make the second display use lv_style_reset instead of lv_style_init, but I suspect this helps avoid memory leaks