I have a screen that is 480 high and 854 wide.I created a page object with size of 854*480.It has six child objects,like this
I suggest using a tabview but hiding the buttons.
Thanks, I have a try.
Hi, I’ve achieved what I want. But I ran into another problem. The object I created needs to be repeatedly deleted and rebuilt. In this case, my app crashed.I think it has something to do with memory，but I don’t konw what to do.
If you enable LVGL logging, there will probably be useful information about the crash. Alternatively, you can use a debugger.
“Couldn’t allocate memory _lv_mem_buf_getOut of memory, can’t allocate a new buffer (increase your LV_MEM_SIZE/heap size.” This is the log.And the memory I allocated to LVGL is 32K.Besides， I increase the size, but the problem remain.
There might be a memory leak in your program somewhere. To track memory usage I recommend adding a memory monitor task like this one. With
lv_task_create(memory_monitor, 5000, LV_TASK_PRIO_MID, NULL); it will print the current heap usage every 5 seconds.
Next, I would try to isolate different groups of widgets till the problem goes away (no continually increasing memory consumption printed by the monitor).
I use lv_obj_del to delete the object which I created.Does this function free the memory occupied by the object？
Hi，embeddedt.I printed the memory usage according to the method you provided and found that it has been increasing.This has something to do with some of my code，and the code like this:code.c (2.6 KB)
It frees everything LVGL allocated. If you allocate something and store it in
user_data, you would be responsible for freeing the user data.
No， I don’t allocate any memory.I just create an object and delete it repeatedly.And then the memory usage increase.
You are reinitializing the styles in
NewAddKnob each time. After the first initialization you should call
lv_style_reset and not
lv_style_init. Continuing to call
lv_style_init will result in a memory leak.
Hi，according to your suggestions,I have solved this problem.Much appreciate.