Description
In the lv_examples, where is the memory freed again for locally allocated space ? As far as I understand, there is a linked list of GUI objects, which grows depending on the objects created. How can I know, when I need to shrink the list again after not using a particular GUI object anymore ? The variable was declared locally in a function and I don’t have any references outside of it (in the lv_examples) ?
What MCU/Processor/Board and compiler are you using?
Linux
What LVGL version are you using?
7.11.0
What do you want to achieve?
I want to prevent memory leaks.
What have you tried so far?
Tried to understand _lv_ll_ins_head and lv_mem_alloc. Do not fully get it.
Code to reproduce
Code from the exmples (just creating a button inside a function) :
#include "../../lv_examples.h"
* Create a button with a label and react on Click event.
*/
void lv_ex_get_started_1(void)
{
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 120, 50); /*Set its size*/
lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
}
How do I know in another function, what potion I have to deallocate ?
Many thanks for any hints and best regards