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 in lvgl_port_remove_disp Related to draw_ctx (BSP-604) #462

Open
1 task done
huhaifan opened this issue Dec 22, 2024 · 0 comments
Open
1 task done

Memory Leak in lvgl_port_remove_disp Related to draw_ctx (BSP-604) #462

huhaifan opened this issue Dec 22, 2024 · 0 comments
Labels

Comments

@huhaifan
Copy link

Board

Custom board

Hardware Description

Custom board

IDE Name

VSCode

Operating System

Windows11

Description

Environment:

LVGL Version: 8.4.0
esp_lvgl_port Version: 2.4.3

Description:

I have encountered a memory leak when calling lvgl_port_remove_disp after lvgl_port_add_disp. The issue seems to originate from the draw_ctx not being properly deinitialized and freed.

  1. Call lvgl_port_add_disp to add a display.
  2. Call lvgl_port_remove_disp to remove the display.
  3. Observe the memory leak related to draw_ctx.

Proposed Fix:

To resolve this issue, I suggest modifying the lvgl_port_remove_disp function to include the following code:

if (disp_drv->draw_ctx) {
    disp_drv->draw_ctx_deinit(disp_drv, disp_drv->draw_ctx);
    lv_mem_free(disp_drv->draw_ctx);
    disp_drv->draw_ctx = NULL;
}

Sketch

lvgl_port_add_disp() then lvgl_port_remove_disp()

Other Steps to Reproduce

No response

I have checked existing issues, README.md and ESP32 Forum

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@huhaifan huhaifan added Status: Awaiting triage Type: Bug Something isn't working labels Dec 22, 2024
@github-actions github-actions bot changed the title Memory Leak in lvgl_port_remove_disp Related to draw_ctx Memory Leak in lvgl_port_remove_disp Related to draw_ctx (BSP-604) Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant