Screen stucked/hanged but serial is working fine

Code

int One,Two;
char formatted[20];
snprintf(formatted, sizeof(formatted), “%dh%02dmin”, One, Two);
lv_label_set_text(ui_Label49,formatted);

Object

// This code to show time One is hour and Two is minute which is am showing in a label.

Problem

Suddenly the screen stucked and touch also do not work, but everything is working fine through serial during the screen is hanged.

I noticed strange charaters on screen which is stucked.

Screen was showing 1h5min and working fine but when it hannged it was showing 1h6??$.

Please help
WhatsApp Image 2024-05-09 at 12.31.07

I tried again to reproduce same problem. But this time the graphic bugged for other things but everything continued to work find.

I am think it might be a problem of ressourses.
OR system did not had enough time to finish calculation so it was showing strange caracters and stucked.

I have a feeling like the screen do not refresh as it should do , i mean a bar indicator shows some missing colors but when bar goes up for example after one minute the bar indicator becomes normal.

Hermit may be you have any idea to help me.

I will add when freez happened it was:

50 FPS
18% CPU
68.8kb uses (36%)
2% frag

Not much is known about the project to guess the exact cause, but it must be resource-related as you already suppose. Something with memory settings (LV_MEM_SIZE/LV_MEM_CUSTOM) might be a cause for freeze and odd behaviour, or maybe you have other service that interferes with the RAM which LVGL lv_label_set_text() uses. C, if used correctly, should protect you from this or show segfault-errors but it depends on the memory handler and settings. (Removing unnecessary parts from the code might be enlightening when you want to find which part causes the sympthom.)
Btw you can possibly do it simpler by using lv_label_set_text_fmt(label, “%dh%02dmin”, One, Two) instead of using the snprintf+lv_label_set_text way. Who knows, it might even solve your problem if it somehow comes from using snprintf() which is a standard-library function on your board out of LVGL.