I have a project with 6 screens each 480x320 in size, and 200 widgets spread across them. I have had to increase the LV_MEM_SIZE multiple times or the app crashes with “LoadProhibited” randomly when creating additional widgets at runtime (e.g. when displaying a MessageBox).
I think the problem is the SquareLine code creates ALL the widgets for all screens in the ui_init method in ui.c whether the screens are going to be shown or not. This is proving to be a limitation on building an app with many widgets.
I think there needs to be an option to have the ui_X_screen init method get called from the SCREEN_LOADING event or somewhere else only when they are needed. If this option exists, I cannot find it currently.
I am currently up to this amount of memory, and my SSL processes have stopped working because LVGL is using most of the heap.
#define LV_MEM_SIZE (82U * 1024U)
Example: some of the screens are very transient. I have one to enter your WiFi credentials. This really is only ever used once, when the app first runs, so it’s a waste to have this residing in memory indefinitly.