Strange issue: program freezes after adding 1 more widget (ESP32-8048S070)

Hi guys, I hope you can help

I’m building a device with Squareline and LVGL 8.3.7, and a 4.3inch ESP32-8048S043 display (ESP32-S3, 16MB flash).
It all compiles fine, touch works great, it’s responsive etc, but i’ve reached a point where adding another widget to the project will freeze the display when the screen is loaded.
There’s no crash on serial, it just freezes.

Working in Arduino IDE: after compilation it shows that the sketch uses 36% of storage and 29% of dynamic memory, so there still seems to be plenty of space left. I have about 50 widgets in total, some transparent pngs, only 1 font.

There is a graph with a temporary 1000 point array but the same issue is observed when the graph is disabled. Adding any more widgets than around 50 freezes the display. Take 1 off, compile and flash, and it works again. Add 1 and it stops working.
Like some kind of limit is being reached.
BTW same thing happens whether the widget is added via Squareline or directly by code.

What could this be, any ideas?
(sorry I can’t share the project very easily, it’s big, lots of files, dependencies etc)

I think the ESP32 uses an RTOS behind the scenes, is there a possibility it’s running out of ram/stack?
The gui task isn’t explicitly set to any core, so the memory allocation is automatic I think.

lv_conf mem size ?

I found the culprit:

Adding a panel with a gradient causes the freeze as soon as it tries to load:

The widget was just a coincidence, seems like adding the gradient adds a certain amount of overhead, which got exceeded with additional widgets being added.

Same crash happens when using a png with a gradient

thanks @Marian_M it’s set to auto (LV_MEM_CUSTOM 0) but I’ll have a look into it

mem custom isnt auto …
and size is other def
#define LV_MEM_SIZE

and for style gradient exist next mem defines in conf…

Thanks @Marian_M, my bad!
I bumped it up from default 48U * 1024U to

#define LV_MEM_SIZE (48U * 1600U)

Now it’s working with the gradients!
Strangely, memory monitor (#define LV_USE_MEM_MONITOR 1) showed around 40% usage before. So it doesn’t look like it’s short :thinking: but it works now so all’s well