The "xxx.bin" file located in the external FLASH which is called by lv_img_set_src() will not be released when the page is switched. The resources occupied by the image will not be released

Description

In version 8.3 lv_img_set_src() The function opens the “xxx.bin” Image file in the external Flash. After switching pages, the memory occupied by this picture will not be released. If this operation is repeated multiple times, it will cause memory overflow and eventually lead to program crash.
When creating a page, use the method of lv_obj_create(NULL) to create the parent object.
May I ask if there is a way to solve this problem? Currently, we are using the c array method to read the image.

What LVGL version are you using?

8.3

What do you want to achieve?

After the page switch, the resources occupied by the pictures should be released.

What have you tried so far?

When switching pages, attempts to retain the current page and to clear the current interface have not worked. Neither lv_obj_del nor lv_obj_clean can solve the problem.

Code to reproduce

typedef struct{

lv_obj_t *About;
lv_obj_t *About_img_Logo;

}lv_ui;
lv_ui mygui;

void scr_About()
{
mygui.About = lv_obj_creat(NULL);
mygui.About_img_Logo = lv_img_creat(mygui.About);
lv_img_set_src(mygui.About_img_Logo ,“F:Logo.bin”);
lv_obj_set_pos(…);
lv_obj_set_size(…);
}

How do you config the LV_IMG_CACHE_DEF_SIZE ?

The current configuration value is 10. After testing, it was found that even after multiple operations, the memory usage still increases, Just the increase is slow.

as far as I understand you use image deocder to open/close bin-files located on external flash. Is it possible to see decoder_open()/decoder_close() methods ?

I didn’t use the decoder because my image is 32-bit color while the screen is 16-bit color. However, when converting to PNG format, the color depth is only 8, 24, or 32. Converting to BMP format would cause image distortion, so I didn’t use the encoder. Currently, I set LV_IMG_CACHE_DEF_SIZE to 50 and there won’t be any memory overflow.