I have successfully upgraded my project from LVGL version 8.4 to version 9.3. The application starts, but after rendering the splash screen, processing stops. I enabled logging and I can see that LVGL is running out of memory. I am using the ESP32-S3 chip, so I have defined custom memory via:
#define LV_MEM_CUSTOM_INCLUDE "esp32-hal-psram.h"//
#define LV_MEM_CUSTOM_ALLOC ps_malloc
#define LV_MEM_CUSTOM_FREE free
#define LV_MEM_CUSTOM_REALLOC ps_realloc
I realize this is a very general question, but what should I be looking for? Log lines:
PSRAM free before LVGL: 7614368 bytes
Initializing LVGL
[Info] (0.000, +0) lv_init: begin lv_init.c:185
[Warn] (0.000, +0) lv_init: Style sanity checks are enabled that uses more RAM lv_init.c:317
[Warn] (0.000, +0) lv_init: Log level is set to 'Trace' which makes LVGL much slower lv_init.c:321
[Trace] (0.000, +0) lv_init: finished lv_init.c:395
[I][LvPort][lvgl_v9_port.cpp:0752](lvgl_port_init): Initializing LVGL display driver
[Info] (0.000, +0) lv_obj_create: begin lv_obj.c:215
[Info] (0.000, +0) lv_obj_create: begin lv_obj.c:215
[Info] (0.000, +0) lv_obj_create: begin lv_obj.c:215
[Info] (0.000, +0) lv_obj_create: begin lv_obj.c:215
Creating UI
LVGL free: 57356 bytes
Largest block: 57332 bytes
///// here it starts creating all of my objects, and there are a lot of them
//// eventually, i get this log:
LVGL free: 6220 bytes
Largest block: 6200 bytes
[INFO] [Info] (4.196, +10) lv_label_create: begin lv_label.c:123
[INFO] [Info] (4.207, +11) lv_malloc_zeroed: couldn't allocate memory (104 bytes) lv_mem.c:102
[INFO] [Info] (4.207, +0) lv_malloc_zeroed: used: 57560 (100 %), frag: 0 %, biggest free: 40 lv_mem.c:106
If I go back to my application running on v8.4, I have no memory issues. I am using
LV_IMAGE_DECLARE
LV_FONT_DECLARE
for images and fonts to make sure they aren’t part of the heap. Obviously my function/API calls are different between the versions, but type and number of objects, etc is the same between both. Is anyone able to help?
Thanks!