Memory leaks often occur in the following code. Please tell me what is the problem

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.


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


What LVGL version are you using?


What do you want to achieve?

What have you tried so far?


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*/
lv_obj_t * objWindow = lv_obj_create(lv_scr_act(), NULL);
lv_obj_t * fpImg = lv_img_create(parent, NULL);
lv_img_set_src(fpImg, &FpCircle_0);
lv_obj_set_pos(fpImg, 24, 60);
while (1)
       switch ( nKeyCode )
            case KEY_ESC:
                goto exit;
         lv_img_set_src(fpImg, &FpCircle_0);
lv_obj_del(objWindow );
printf("AddUser Exit@1");

AddUser Exit@1
CPU Exception: NO.2
r0: 007d3834	r1: 01c6b480	r2: 00000001	r3: bbbbbbbb	r4: 007d3834	
r5: 00000000	r6: 00000000	r7: 01c6b4c8	r8: 006d6bdc	r9: 006d655c	
r10: 006d6c24	r11: 00000048	r12: 0000003c	r13: ffffbbbb	r14: 01c6b478	
r15: 00172868	r16: 28282828	r17: 12345678	r18: 12345678	r19: 12345678	
r20: 12345678	r21: 12345678
## Screenshot and/or video
If possible, add screenshots and/or videos about the current state.

I have the same problem. There is a chart in my poject, when the container of chart is delete the memories does not be released completely. After several operations(create and delete), the usage of memory is increased Horribly.
My solution is hide the container of the chart and the usage of the memory does not change!

lv_obj_add_flag(container, LV_OBJ_FLAG_HIDDEN);

and re-open via clear the flag

lv_obj_clear_flag(container, LV_OBJ_FLAG_HIDDEN);

But, I still hope there is a way to release memory complete when the obj is delete. It is important for a device with few memory.

Thanks for your reply. I also hope release memory complete.

Can you send a code reproduce the issue in v8?
If there is a memory leak it needs to be fixed.