Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak with shadow enabled? #7835

Open
Suprazz opened this issue Feb 24, 2025 · 1 comment
Open

Memory leak with shadow enabled? #7835

Suprazz opened this issue Feb 24, 2025 · 1 comment

Comments

@Suprazz
Copy link

Suprazz commented Feb 24, 2025

LVGL version

9.2.2

Platform

I'm using esp32s3
I set LV_MEM_SIZE to 128*1024U

What happened?

by monitoring memory usage with lv_mem_monitor
my normal free_size usage is around 70k and max_used is around 64k
but if I unhide this widget and display this screen my max_used goes to 122 000 and most of the time will crash.

lv_obj_set_pos(obj, 150, 150);
            lv_obj_set_size(obj, 180, 180);
            lv_arc_set_value(obj, 50);
            lv_arc_set_bg_start_angle(obj, 0);
            lv_arc_set_bg_end_angle(obj, 360);
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);            
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE|LV_OBJ_FLAG_CLICK_FOCUSABLE|LV_OBJ_FLAG_PRESS_LOCK|LV_OBJ_FLAG_SCROLL_ELASTIC|LV_OBJ_FLAG_SCROLL_MOMENTUM|LV_OBJ_FLAG_SCROLL_WITH_ARROW|LV_OBJ_FLAG_SNAPPABLE);
            lv_obj_set_style_arc_width(obj, 0, LV_PART_INDICATOR | LV_STATE_DEFAULT);
            lv_obj_set_style_bg_opa(obj, 0, LV_PART_KNOB | LV_STATE_DEFAULT);
            lv_obj_set_style_arc_color(obj, lv_color_hex(0xff05b6ff), LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_arc_width(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_border_color(obj, lv_color_hex(0xff0087ff), LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_border_opa(obj, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_border_side(obj, LV_BORDER_SIDE_FULL, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_radius(obj, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_shadow_opa(obj, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_shadow_spread(obj, 10, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_shadow_color(obj, lv_color_hex(0xff4181f6), LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_arc_opa(obj, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_shadow_ofs_x(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
            lv_obj_set_style_shadow_width(obj, 80, LV_PART_MAIN | LV_STATE_DEFAULT);

I found that in the function circ_calc_aa4 there is no check for null pointer on circ_x
int32_t * cir_x = lv_malloc_zeroed(cir_xy_size); and this is where my program crashed but

But the real problem is why is the memory max_used jump from 64k to 122k only on this widget.
I had another simillar issue with horizontal sliders using gradians too.
It seems to be related to the drawing of the gradian or shadow used by this widget creating a memory leak?

How to reproduce?

No response

@kisvegabor
Copy link
Member

Hi,

I believe the rendering of this large shadow required more memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants